下午好,
我正在使用 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)