我正在使用pie3D
包中的plotrix
绘制3D饼图:
dev.new(width=6, height=5)
pie3D(weights, radius = 0.8, labels=paste(names(weights), labels, sep = "\n"), explode=0.05, mar=c(4, 4, 4, 4), border = F, col = my.col, main="Asset Allocation", labelcex = 0.8, shade = 0.5)
我得到以下内容:
如您所见,标签位于彼此之上。我尝试修改mar
输入(边距),但它不太起作用。是否有办法增加图表上标签之间的间距,以便减少堵塞?请记住,我希望图表的半径保持固定为0.9
谢谢!
答案 0 :(得分:3)
我猜你正在寻找pie3D.labels
。 E.g:
library(plotrix)
vec <- sample(1:10)
labs <- paste('piece \n no', 1:10, sep = " ")
par(mfrow = c(2,1))
a <- pie3D(vec, radius = 0.8, explode = 0.05, mar = c(1,1,1,1))
pie3D.labels(a, radius = 0.8, labels = labs, labelcex = 0.7)
b <- pie3D(vec, radius = 0.8, explode = 0.05, mar = c(1,1,1,1))
pie3D.labels(sample(seq(0, 2*pi, 0.1), 10), radius = 0.8, labels = labs, labelcex = 0.7)
情节: