This tutorial focuses on the two main tools for looking at mapping Spatial* objects – the basic plot command, and the more refined plot command spplot from the sp library. Note there are also ways to use tools like ggplot and ggmap (designed to make working with maps in ggplot easier),, but in this workshop we’ll focus on plot and spplot.

Although there are other tools available for more sophisticated applications, most plotting situations can be handled through the use of two functions:

1. plot

The syntax for each should be relatively familiar to anyone used to working with plot in other settings – just pass the sp object to plot!

palo_alto <- readOGR("RGIS3_Data/palo_alto", "palo_alto")
OGR data source with driver: ESRI Shapefile 
Source: "RGIS3_Data/palo_alto", layer: "palo_alto"
with 371 features and 5 fields
Feature type: wkbPolygon with 2 dimensions