質問

I am plotting a 3D pie chart using pie3D from plotrix package:

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)

and I get the following:

enter image description here

As you can see, the labels are on top of each other. I tried modifiying the mar input (margins), but it doesn't quite work. Would there be a way to increase spacing between the labels on the graph, so that it is less jammed? Please keep in mind that I want the radius of the graph to stay fixed at 0.9

Thanks!

役に立ちましたか?

解決

I guess you're looking for 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)

The plot:

pie3d

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top