[R] [R-sig-Geo] plot methods in sp

Edzer J. Pebesma e.pebesma at geo.uu.nl
Mon Jan 1 16:47:24 CET 2007


Patrick, I can see this is confusing.

Besides methods(plot), try after library(sp) a

showMethods(plot)

to get an overview of the S4-style plot methods; methods(plot) only 
shows the S3-style plot methods. Then,

class?SpatialPolygons

gives methods available for this class, among which plot, and the html 
listing of plot methods has entries like

plot.SpatialPolygons,missing-method

that points to the same help page (which is rather brief).

getMethod("plot", c("SpatialPolygons", "missing"))

shows you the arguments this method takes, and shows that it actually 
calls plot.SpatialPolygons. This method is not exported from sp, so to 
view it you need to access it as

 sp:::plot.SpatialPolygons
 
the other sp functions it calls can also be accessed by preceding them 
with sp:::

I agree that more elaborate documentation along with examples would be 
useful.

Hope this helps,
--
Edzer

Patrick Giraudoux wrote:
> Dear listers,
>
> I am working since a while with the sp package and still wonder how the 
> plot methods are managed with sp spatial objects. For instance, 
> SpatialPolygonsDataFrame objects have obviously a plot method. However 
> it cannot be found in the list provided by methods(plot) . Furthermore 
> ?plot.SpatialPolygonsDataFrame, nor ?plot.SpatialPolygons, etc.. provide 
> a help, though the lattice function spplot is adequately documented.
>
> On the other hand, plot(myobject, border="grey"), with myobject a 
> SpatialPolygonsDataframe is well interpreted and recalls the syntax of 
> plot.polylist of matools (though myobject is far from being a polylist...).
>
> Can anybody (especially the package's authors...) comment on this? Where 
> a help with the list of the plot function arguments can be found?
>
> Thanks for any hint,
>
> Patrick
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-help mailing list