I have created multiple pie charts with legends in ggplot
. I am also using rworldmap
to create maps of Eurasia with coordinates plotted as points on the map.
The pie charts I have correspond to the points I have plotted on my maps. My end goal is to overlay the pie charts I have created in ggplot
on to my rworldmap
plots, and then display all of the maps in a grid. I would also like to add the legends from my ggplot
pie charts to the maps.
I have added my pie chart to an object(?) AD_Pie
, using AD_Pie <- ggplot(df, aes...) +
etc.
I have created my map using:
AD_Map <- getMap(resolution = "low")
plot(AD_Map, xlim = c(-27.0, 174.0), ylim = c(17.5, 75.0), col = "grey",border = "darkgrey", xlab = "", ylab = '' , bg= "lightblue")
points(Coordinate_AD_Clean$long, Coordinate_AD_Clean$lat, col = "red", pch = "+")
Coordinate_AD_Clean
is my data frame.
My question is whether there is a way to overlay AD_Pie
on to my plot in rworldmap
. There doesn't need to be any interaction between the two plots, so hypothetically it would be enough to have even an image of the pie chart overlayed on to the map saved as a single plot that I can then add to a grid/matrix of all the completed plots.
There is a mapPies
function in rworldmap
and some functionality to add new pie charts to maps using this package, but the pies I have created in ggplot
have taken significant data formatting and tweaking to get to, so using this function is not really an option.
I am very much hoping that some sort of overlaying function exists in either ggplot
or rworldmap
that I can use to put these pieces together. If you can help I would appreciate it greatly. Thanks for reading, and let me know if any further information is required.
Not exactly an answer, but solutions may be easier by using the ggmap
package instead of rworldmap
.