Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Retrieve map data from the maps package and draw it with geom_polygon()
(which can have a color fill) or geom_path() (which
can’t have a fill). By default, the latitude and longitude will be drawn
on a Cartesian coordinate plane, but you can use coord_map() and
specify a projection. The default projection is "mercator", which, unlike the Cartesian plane,
has a progressively changing spacing for latitude lines (Figure 13-32):
library(maps)# For map data# Get map data for USAstates_map<-map_data("state")ggplot(states_map,aes(x=long,y=lat,group=group))+geom_polygon(fill="white",colour="black")# geom_path (no fill) and Mercator projectionggplot(states_map,aes(x=long,y=lat,group=group))+geom_path()+coord_map("mercator")