[R] Adding image to plotting area
Jim Lemon
jim at bitwrit.com.au
Fri Jan 28 11:18:16 CET 2011
On 01/28/2011 11:00 AM, Dario Strbenac wrote:
> Hello,
>
> I've drawn a black rectangle over the plotting area, and when I add an image() heatmap, it doesn't take up all the area, but is set inward from the black rectangle. Can anyone suggest how to make it stretch out to the entire area ?
>
> Minimal example :
>
> y<- matrix(runif(2000*20), nrow = 2000)
> y[100:200, 10] = NA
> plot.new()
> usr<- par('usr')
> rect(usr[1], usr[3], usr[2], usr[4], col="black")
> image(t(y), add = TRUE)
>
Hi Dario,
Try this magic incantation before plotting:
par(xaxs="i",yaxs="i")
Jim
More information about the R-help
mailing list