[R] Plotting shapefiles on existing maps
ray at mcs.vuw.ac.nz
Wed Mar 29 23:00:34 CEST 2006
> From: nhy303 at abdn.ac.uk
> I have plotted a map of the Barents Sea and surrounding coastline using:
> Next, I imported a shapefile with depth contours for the sea:
> contours<-read.shape("D://My Documents/BarentsSea.shp",dbf.data=T)
> (This is in mercator projection).
> Despite extensive searches of the help files and R site, I cannot find a
> way to plot the contours onto the map. Does anyone have any suggestions?
It is not clear to me exactly what you are having difficulty with, but
if you are able to produce a contour plot from that data, then note that
both contour() and map() have an "add" argument, so as long as the axis
limits are conformant (i.e. both longitude/latitude) you can add one
plot to the other.
Perhaps the trick is in converting your contours data into
longitude/latitude form for the x and y components.
Hope this helps,
More information about the R-help