Skip to content
Prev 19924 / 29559 Next

3rd+ rasters added using "plot(r, add=TRUE)" are misregistered

I just wonder if this is related to an existing resize problem when
overplotting? I see this on the windows() graphics device, you need to
try these two sets of plot commands and resize the window (especially
stretch it in one direction) to see the problem at ## 1 and ## 2

v <- list(x = seq(0, 1, length = nrow(volcano)), y = seq(0, 1, length
= ncol(volcano)), z = volcano)
cl <- contourLines(v, levels = 160)[[2]]

image(v, xaxs = "i")
lines(cl)
## (1) now resize the window, it's all good - the contour stays in the
## right place


## however, resize after adding the lines to a raster plot
## and the relationship is broken
library(raster)

plot(raster(v), xaxs = "i")

lines(cl)

## (2)

May be totally unrelated but I thought it worth pointing out. It's
hard to trace through the setting up that raster's plot does (well, I
find it hard to do - I've tried a few times to figure out where these
problems are happening).

Cheers, Mike.
On Wed, Dec 4, 2013 at 5:57 AM, Josh O'Brien <joshmobrien at gmail.com> wrote: