下午好,
我正在使用geom_scatterpie(R)将饼图绘制在世界各地。对于某些馅饼,我有空格,而且我不知道如何解决该问题
我检查了每个站点的百分比总和,等于1。
有人遇到过同样的问题,并且找到了解决方案吗?
非常感谢您的帮助, 干杯, 萨尔玛。
# World map
world <- map_data('world')
world
p2 <- ggplot(world, aes(long, lat)) +
geom_map(map=world, aes(map_id=region), fill=NA, color="black") +
coord_quickmap()
#Increase the size of the axis text and axis titles of the world map
p2 <- p2 + labs(x = "Longitude") + labs(y = "Latitude") +
theme(axis.text.y = element_text(size = 18, color = "black")) +
theme(axis.text.x = element_text(size = 18, color = "black")) +
theme(axis.title = element_text( face="bold", size=28)) +
labs(fill="") #add a title to the legend
p2 <- p2 + geom_scatterpie(aes(x=POINT_X, y=POINT_Y, group=region, r=radius*350, sorted_by_radius = TRUE), data=classification, cols=c("No data", "Stable", "Accretion", "Erosion", "Extreme erosion", "Intense erosion", "Severe erosion"), alpha=0.7) + coord_equal()+ geom_scatterpie_legend(classification$radius, x=-200, y=-50, n=3)
# legend title
p2 <- p2 + theme(legend.title = element_text(colour="black", size=18,
face="bold"))
# legend labels
p2 <- p2 + theme(legend.text = element_text(colour="black", size=18))
colors <- c( '#4575b4','#fee090', '#fdae61', '#f46d43','#DCDCDC', '#d73027', '#e0f3f8' )
p2 <- p2 + scale_fill_manual(name = "", values = colors)