Plotrix包3D饼图图例显示不全问题求助
使用plotrix绘制3D饼图时图例显示不全(超出画布)的问题
我用plotrix包绘制3D饼图时,图例无法完整显示,图例框部分超出画布范围,之前求助过但未达到预期效果。当前生成的图表如下:

我的代码
pie1_PGS <- pie1_PGS[!(pie1_PGS$nb_sejours_2021 == 0),] lab <- paste0(round(pie1_PGS$nb_sejours_2021/sum(pie1_PGS$nb_sejours_2021) * 100, 2), "%") library(plotrix) pie3D(pie1_PGS$nb_sejours_2021, radius = 0.75, height = 0.1, theta = 0.7, border = "white", col = rainbow(length(lab)), shade = 0.5, labels = lab, labelcol = "red", labelcex = 0.75, explode = 0.2, main = "Répartition des séjours 2021 par type") legend(0.5, 1.1, pie1_PGS$type_de_sejour, cex = 0.3, fill = rainbow(length(lab)))
我的数据集
structure(list(type_de_sejour = structure(c(1L, 2L, 4L), levels = c("Ambulatoires", "Externes", "Fictifs", "Hospitalisé"), class = "factor"), nb_sejours_2021 = c(20794, 365, 7866)), row.names = c(1L, 2L, 4L), class = "data.frame")
恳请各位帮忙解决该问题!
内容的提问来源于stack exchange,提问作者gerardlambert
相关产品推荐
相关产品推荐

