Hello I want to make a world map like the picture with my data. I was wondering if anyone can help me with the code?
I would suggest to try with the different pieces.
- The worldwide choropleth: there are multiple examples where to get inspired. Google is your friend.
- The pie charts for the different continents
Post here what you have done and eventually where you got stuck...
(Let's say it: your request is too generic and showing no effort on your side or any details [for example data])
For start, you could make the basic map with this:
library(ggplot2) library(maps) library(rworldmap) library(ggrepel) world_map <- getMap() ggplot() + geom_polygon(data = world_map, aes(x = long, y = lat, group = group), fill = "white", color = "black") + coord_fixed(ratio = 1.3) + # Adjust the ratio for better aspect theme_void() # Remove background and axes
Hello @M_AcostaCH ,
Thank you for your advice.
I used this code with my specific data:
ggplot(merged_data, aes(x = long, y = lat, group = group, fill = value)) +
geom_polygon(color = "grey", size = 1) +
scale_fill_gradient(low = "lightblue", high = "darkblue", na.value = "white") +
I have the outlines for the continents but I want the outline for all the countries like your picture.
Also, for some reason there is triangle in the middle of Africa that I cant seem to get rid of. Can you please look it over?
Without data is difficult make a good example for help you. Try to put a reproducible example of data.
I find an example of this map here:
see for avoid the triangle problems.