Skip to content

Adjusting coordinates in raster plots

2 messages · Jan Sudeikat, David L Carlson

#
Dear R-Help,

When plotting a raster object the origin (0,0) is placed in the center.

E.g. using: 
library(raster)
mat = matrix(runif(100),10,10)
r <- raster(ncol=10, nrow=10)
values(r) <- mat
plot(r, main='Raster example',xlab="x",ylab="y") 

Does anyone know how to adjust the coordinate system?
E.g. I would like to have 0,0 at the top left.
My naive approach was to use "axis()" but this has no effect.

Thanks in advance for any advice.

Best regards,
Jan
#
Like this?

r <- raster(ncol=10, nrow=10, xmn=0, ymx=0)
values(r) <- mat
plot(r)

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352