Entering edit mode
                    2.9 years ago
        waqaskhokhar999
        
    
        ▴
    
    160
    Hi, I have generated the pie charts on a geographical map using ggplot following the tutorial (https://towardsdatascience.com/using-ggplot-to-plot-pie-charts-on-a-geographical-map-bb54d22d6e13),
# Using map_data()
worldmap <- map_data ("world")
colours_group = c("#EE2700", "#5EFF01","#94569d", "#3404FE","#FBFF00", "#F200FE", "#6AFDFF", "#F29A03","#7F415C", "#F3985D")
mapplot1 <- ggplot(worldmap) +
  geom_map(data = worldmap, map = worldmap, aes(x=long, y=lat, map_id=region), color = "black", fill = NA) +
  geom_scatterpie(aes(x=longitude, y=latitude, group = Countries, r = multiplier*6),
                  data = final_data, cols = colnames(final_data[,c(2:11)])) + 
  scale_fill_manual("vunrisk", values = colours_group)
mapplot1 + theme(axis.title.x = element_blank(), axis.title.y = element_blank(), axis.text.x =element_blank(), axis.ticks.x = element_blank(), axis.text.y = element_blank(), axis.ticks.y = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
                 panel.background = element_blank(), axis.line = element_blank())
I am trying to replace the default colours with the following colours but its not working:
colours = c("#EE2700", "#5EFF01","#94569d", "#3404FE","#FBFF00", "#F200FE", "#6AFDFF", "#F29A03","#7F415C", "#F3985D")