How to smooth a plot produced with image function in R?

Viewed 411

I'm producing an elevation map with R base function "image". Nonetheless, I'd like to get a smoother transition between levels so the image looks less pixelated. The logical solution is adding a wider color palette, which I already did, but the result isn't satisfactory yet. How can I achieve a nice smoothing effect without altering the coordinate system (I need it to overlay 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))
1 Answers
Related