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?
Hi,
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
- Combine
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])
Hi @enakkhistc, you could find better help if you put a reproducible example of data.
See this:
Reprex
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) +
geom_polygon() +
scale_fill_gradient(low = "lightblue", high = "darkblue", na.value = "white") +
theme_void()
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?
Thank you.
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.
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.