Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Draw a world map is ridiculously slow #666

hadley opened this Issue Sep 19, 2012 · 4 comments


None yet
2 participants

hadley commented Sep 19, 2012


world_map <- geom_polygon(aes(long, lat, group = group),
  data = map_data("world"), fill = NA, colour = "white", inherit.aes = FALSE)

ggplot() + world_map

wch commented Sep 25, 2012

I just tested this out with earlier version (0.8.9, 0.9.0, 0.9.1), and it's still slow. I suspect it's because there are just a lot of segments in a whole world map. I think it's possible to request lower resolution polygons from the maps package.


hadley commented Sep 25, 2012

geom_path is much much much faster. It's probably because geom_polygon creates a grob for each group, rather than one grob with the appropriate id set


wch commented Oct 13, 2012

Do you think there would be any problems with changing geom_polygon so it uses one grob for all the groups? It is extremely slow.


hadley commented Oct 15, 2012

I don't think so - and it should have a big performance impact. I can't believe that I didn't notice this before.

@wch wch closed this Oct 23, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment