Skip to content

Instantly share code, notes, and snippets.

@mfmakahiya
Created October 25, 2018 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfmakahiya/fa86f2f0072d6192f52ebac24cc89231 to your computer and use it in GitHub Desktop.
Save mfmakahiya/fa86f2f0072d6192f52ebac24cc89231 to your computer and use it in GitHub Desktop.
# Using map_data()
worldmap <- map_data ("world")
mapplot1 <- ggplot(worldmap) +
geom_map(data = worldmap, map = worldmap, aes(x=long, y=lat, map_id=region), col = "white", fill = "gray50") +
geom_scatterpie(aes(x=longitude, y=latitude, group = country, r = multiplier*6),
data = final_data, cols = colnames(final_data[,c(2:11)])) +
xlim(-20,60) + ylim(10, 75) +
scale_fill_brewer(palette = "Paired") +
geom_text(aes(x=longitude, y=latitude, group = country, label = country), data = final_data, stat = "identity",
position = position_dodge(width = 0.75), hjust = 1.5, #vjust = -1.5, size = 5, angle = 45,
check_overlap = TRUE, na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE) +
labs(title = "Causes of death by country", x = "Longitude", y = "Latitude") +
theme(legend.position = "top")
mapplot1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment