I am creating a height map with the base function R "image". However, I would like to get a smoother transition between the levels so that the image looks less pixelated. The logical solution is to add a wider color palette, which I have already done, but the result is not yet satisfactory. How can I achieve a nice smoothing effect without changing the coordinate system (I need it to overlap a series of segments and points)?
x <- 10*(1:nrow(volcano))
y <- 10*(1:ncol(volcano))
shades = colorRampPalette(c("yellow", "red"))
image(x, y, volcano,
col=shades(100),breaks=seq(min(volcano),max(volcano),
(max(volcano)- min(volcano))/100),axes = FALSE)
segments(x0=c(100,600), x1=c(600,100),
y0=c(100,600),
y1=c(600,100))
points(x=seq(100,800,100), y=rep(300,8),pch=16,col="blue",cex=3)
axis(1, at = seq(100, 800, by = 100))
axis(2, at = seq(100, 600, by = 100))
source
share