[R-sig-Geo] plotting latlon axes of sp object of different projection
horacio.samaniego at gmail.com
Tue Jul 5 20:20:39 CEST 2011
Thanks a lot Roger,
This is a good recipe, I'ld never have figured by my own!
To fine tune this, I need to place the labels on the other sides
(north, east) of the graph. Modifying the pos column of the grdat
object (output of gridat()) does not do the trick. I imagine that any
modification should happen in the coordinates of that object.
So I wonder if that is achievable earlier in the process.
Any helpfull thought on doing that? It would be much appreciate.
On Tue, Jul 5, 2011 at 5:20 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> On Mon, 4 Jul 2011, Horacio Samaniego wrote:
>> I need to add a lat/lon axes to an equal area plot of a
>> SpatialLinesDataFrame object currently in units of meters. Is that
>> achievable using sp/maptools?
>> The .prj file where the object comes from is:
>> I'ld hate to install arcinfo to generate 1 plot! (plus the plot is
>> already nice as it is!!! just need the axes!)
> No, the axes are in the same coordinate system as the plot, and would be
> curves here. You can overplot a long-lat grid on a projected plot:
> coordinates(meuse) <- ~x+y
> proj4string(meuse) <- CRS("+init=epsg:28992")
> meuse_ll <- spTransform(meuse, CRS("+proj=longlat +datum=WGS84"))
> grd <- gridlines(meuse_ll)
> grd_x <- spTransform(grd, CRS("+init=epsg:28992"))
> plot(grd_x, add=TRUE, lty=2)
> grdat_ll <- gridat(meuse_ll)
> grdat_x <- spTransform(grdat_ll, CRS("+init=epsg:28992"))
> text(coordinates(grdat_x), labels=parse(text=grdat_x$labels),
> pos=grdat_x$pos, offset=grdat_x$offset)
> Hope this helps,
>> I'll summarize!
> Roger Bivand
> Department of Economics, NHH Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand at nhh.no
Center for Nonlinear Studies
Los Alamos National Laboratory
Los Alamos, New Mexico 87545
Instituto de Silvicultura
Universidad Austral de Chile
More information about the R-sig-Geo