Skip to content

Adding image to plotting area

2 messages · Dario Strbenac, Jim Lemon

#
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)

Thanks,
       Dario.
#
On 01/28/2011 11:00 AM, Dario Strbenac wrote:
Hi Dario,
Try this magic incantation before plotting:

par(xaxs="i",yaxs="i")

Jim