R - plot smooth pie on worldmap

163 Views Asked by At

I am trying to plot pie charts on a worldmap. This is a simplified example of my code so far:

library(rworldmap)
library(ggplot2)
library(scatterpie)

WorldData <- map_data('world') 
toPlot <- data.frame(long = 0, lat = 0, r = 20, A = 5, B = 2, C = 10 )

dev.new();
ggplot( ) + 
  geom_polygon( data =  map_data('world') , aes(long, lat, group = group),
                fill = 'black', colour = 'grey', size=0.5 ) + 
  coord_fixed(1.3) + 
  
  geom_scatterpie(aes(x=long, y=lat, r=r ), 
                data = toPlot , cols=c("A", "B", "C"),
                color=NA, alpha=1, n = 1000 , linetype = 2 ) +
  theme(legend.position = 'none')

The problem is that the piechart looks very crude. I tried changing the number of points used to draw the full circle (inherited from geom_arc_bar) and the linetype but it doesn't seem to have any effect.

How can I make it look smoother?

0

There are 0 best solutions below