I am looking to make a heatmap in R displaying the diversity of islands around the world, but I’m having difficulty finding the right way to do this. I have made heatmaps before of states in the US and countries in the world with the ggplot2 and maps packages, but this time I cannot find the right template to use. The boundaries in the heatmap really need to be based on natural geography, and not political geography. For example, islands like Hispaniola and Borneo need to be one entity (as opposed to 2 or 3 countries), and islands like Java and Sumatra need to be separate entities (as opposed to just a single country). If such a template does not exist, is there any way to do this manually?
I tried using the ggplot2 default world map to create my heatmap, but I wasn’t able to split up/combine countries to display the actual information I wanted.
plot1 <-ggplot(map.df, aes(x=long,y=lat,group=group))+
geom_polygon(aes(fill=species))+
geom_path()+
scale_fill_gradientn(colours=rev(heat.colors(50)),na.value="grey90")+
coord_map()
I used this code to actually construct the heatmaps, which I believe should be correct. My problem is changing the boundaries.
The figure should look something like this. Here the authors use river drainage basins to assign different regions on the heatmap. I only need individual islands for my heatmap.
Paul Fedorowicz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.