[R] Adjusting coordinates in raster plots

David L Carlson dcarlson at tamu.edu
Thu Aug 9 04:51:52 CEST 2012


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


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Jan Sudeikat
> Sent: Wednesday, August 08, 2012 3:54 PM
> To: r-help at r-project.org
> Subject: [R] Adjusting coordinates in raster plots
> 
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list