Skip to content
Prev 311390 / 398513 Next

Is it possible to draw with function "image.asc " and show a legend strip in the same window?

On Nov 20, 2012, at 3:15 AM, riodementa wrote:

            
You will notice that the image function in base r graphics uses a [0,1] x [0,1] coordinate system. 

x <- y <- seq(-4*pi, 4*pi, len=27)
 r <- sqrt(outer(x^2, y^2, "+"))
 image(z = z <- cos(r^2)*exp(-r/6), col=gray((0:32)/32))  # NOT the same plotted range as input.
 points(0,0)  # appears in lower-most,  left-most cell
 points(0.5,0.5, col= "red")  # appears in center

If the image.asc function ( in whatever unnamed package it resides in) uses the same transformation strategy, then you will need to transform your point values, using the values of the x and y ranges of your input data.