worldbank / wbgviz

Several R packages for World Bank-standard visualisations, building on ggplot2
MIT License
30 stars 12 forks source link

map does not show countries that are not in the dataframe #22

Open drkarthi opened 6 years ago

drkarthi commented 6 years ago

For example, if the dataframe has only 30 countries, then only the 30 countries are plotted on the map.

map_error

econandrew commented 6 years ago

Yes, this is annoying isn't it. It's a "feature" of using geom_map, as I recall. The current fix is to right_join the full country codes before mapping - just search right_join in the sdgatlas2018 repo and you'll find an example.

But we really need to rethink maps a bit. geom_map and geom_polygon do basically the same thing; the sf package was a bit flaky 6 months ago so I didn't use it, but it's probably more mature now.

Chances are we won't do this during the course of the atlas though, unless we start to have more funky maps that don't work at all in the current setup.