Graphics Reference
In-Depth Information
Figure 13-33. Specific regions from the world map
If there is a separate map available for a region, such as
nz
(New Zealand), that map data will
# Get New Zealand data from world map
nz1
<-
map_data(
"world"
, region
=
"New Zealand"
)
nz1
<-
subset(nz1, long
>
0
&
lat
>
-48
)
# Trim off islands
ggplot(nz1, aes(x
=
long, y
=
lat, group
=
group))
+
geom_path()
# Get New Zealand data from the nz map
nz2
<-
map_data(
"nz"
)
ggplot(nz2, aes(x
=
long, y
=
lat, group
=
group))
+
geom_path()