library(RcppColors)
x <- y <- seq(-1.7, 1.7, length.out = 512L)
zarray <- outer(y, x, function(x, y) {
z <- x + 1i*y
(1 + 1i) * log(sin((z^3 - 1)))
})
# image
img1 <- colorMap1(zarray)
# r -> b, g -> r, b -> g
img2 <- permuteRGB(img1, "brg")
# plot
opar <- par(mar = c(0,0,0,0), mfrow = c(1, 2), bg = "#002240")
plot(
c(0, 1), c(0, 1), type = "n", asp = 1,
xlab = NA, ylab = NA, axes = FALSE
)
rasterImage(img1, 0, 0, 1, 1, interpolate = TRUE)
plot(
c(0, 1), c(0, 1), type = "n", asp = 1,
xlab = NA, ylab = NA, axes = FALSE
)
rasterImage(img2, 0, 0, 1, 1, interpolate = TRUE)
par(opar)
Run the code above in your browser using DataLab