I want to plot a simple world map with gpplot, but when I do, antarctica gets cut off, because the coordinates don't wrap around, so the path goes back across the whole map, instead of going out the edges. For example:
world_data <- map_data("world")
ggplot() + scale_y_continuous(limits=c(-90,90), expand=c(0,0)) +
scale_x_continuous(expand=c(0,0)) +
theme(axis.ticks=element_blank(), axis.title=element_blank(),
axis.text=element_blank()) +
geom_polygon(data=world_data, mapping=aes(x=long, y=lat, group=group), fill='grey')
Produces:
But the sounthern most part of antarctica is missing - it should look like this:
Is there a simple way to fix this problem?
The wrld_simpl
data file from the maptools
package seems to have more reliable map data, including data for Antarctica that goes all the way to -90 degrees latitude. For example:
library(maptools)
data(wrld_simpl)
ggplot() +
geom_polygon(data=wrld_simpl,
aes(x=long, y=lat, group=group), fill='grey20') +
coord_cartesian(xlim=c(-180,180), ylim=c(-90,90)) +
scale_x_continuous(breaks=seq(-180,180,20)) +
scale_y_continuous(breaks=seq(-90,90,10))