Skip to content

How can I change the longitude scale on the plotMap() PBSmapping package

2 messages · Fabio Caltabellotta, Roger Bivand

#
Dear R-helpers,

I am using the package PBSmapping and I have a question on the fuction plotMap:


How can I change the longitude scale on data(worldLLhigh)? I changed
the coordinates of ylim () and xlim () on the function plotMap to plot
my study area. I would like to plot the Brazilian coastline that goes
from the latitude -26.0?S to -21.0?S and longitude from -48.0?W to
-45.0?W. However how can I change the scale value of xlim ranging from
312.0 to 315.0 for the scale of longitude 48.0W-and-45.0W to the same
area?. Can anyone help me?


Thanks,
1 day later
#
You cannot, plotMap() decides things for you. For more flexibility than:

polys <- data.frame(PID=rep(1,4), POS=1:4, X=c(0,1,1,0), Y=c(0,0,1,1))
plotMap(polys, xlim=c(-.5,1.5), ylim=c(-.5,1.5), projection="LL")

from the help page, consider trying:

library(sp)
library(maptools)
sp_polys <- PolySet2SpatialPolygons(as.PolySet(polys, projection="LL"),
close_polys=TRUE)
plot(sp_polys, xlim=c(-.5,1.5), ylim=c(-.5,1.5), axes=TRUE)

Also consider following up on the R-sig-geo list.

Roger
Fabio Caltabellotta wrote:
-----
Roger Bivand
Economic Geography Section
Department of Economics
Norwegian School of Economics and Business Administration
Helleveien 30
N-5045 Bergen, Norway