Skip to content
Prev 22126 / 29559 Next

maptools issue

The first thing to do is to find out the class of the object you are
plotting. For example, in this example:

library(maptools)
xx <- readShapePoints(system.file("shapes/baltim.shp",
package="maptools")[1])
plot(xx)

Then:
[1] "SpatialPointsDataFrame"
attr(,"package")
[1] "sp"



This indicates that you are using the plot() function from the sp package.
[1] "package:sp"       "package:graphics"


The plot function in the sp package is built on the plot function in the
graphics package, that is, the  plot() that is included with R. This
implies that the possible arguments include those of the basic plot
function. For example:

plot(xx, cex=2)
plot(xx, cex=2, col='red', pch=4)


Exactly what the additional arguments do depends on the class of the
object you're plotting.

For lines objects, see ?lines
For polygon objects, see ?polygons
For points objects, see ?points

(that list is an abbreviated version of Table 3.2 in the book Applied
Spatial Data Analysis with R, by Bivand, Pebesma, and Gomez-Rubio; get a
copy if you can!)

Final suggestion; if you are using the "read" functions from maptools as
in the example above, I would suggest installing the rgdal package and
using readOGR() instead. I think you will be better off in the long run
(and I'm pretty sure this is what the experts have been recommending).

-Don