1

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!

Mayou
  • 8,498
  • 16
  • 59
  • 98
  • Whoever downvotes the question must think that the answer is obvious. Could you please then provide a constructive answer instead, or at least an explanatory comment as to why the downvote? A simple -1 is anything but constructive – Mayou Oct 18 '13 at 14:58
  • 6
    I did not downvote, but since you made the same comment on your last (deleted) question, you should be aware that there are many other reasons to down vote a question besides someone thinking that it's "obvious". (In this particular case, pie charts, not to mention 3D pie charts, are sure to attract some haters. They are terrible, terrible things.) – joran Oct 18 '13 at 14:59
  • Well, in the context of asset allocation, it serves the purpose.. – Mayou Oct 18 '13 at 15:02
  • 3
    Besides the distaste for pie charts, especially ones that are pseudo rotated, the is also a distaste for questions that are posed with no data. – IRTFM Oct 18 '13 at 15:53
  • I didn't think data was relevant in this case. I am assuming there is an option in the function `pie3D` that does the trick, and was hoping for a hint on that, and actual data is not related to the display of labels at all! As for the graph itself, there is nothing more relevant than a pie chart for asset allocation. – Mayou Oct 18 '13 at 15:55
  • 2
    The only thing that is worse than a pie chart for data visualisation is a 3D pie chart. This type of visualisation gives unequal visual weight to equal components. Try a stacked bar chart instead, for example. – Andrie Oct 18 '13 at 16:33
  • 1
    To my eye, the 8% for Agriculture as a thin triangle has less visual impact (ie appears smaller) than the 7% for Intl.Developed.Equities as a thick triangle. Add the visual impact of the pie sides which are only visible on the near items and you get a seriously bad graphic. Stop it now. [No reason to downvote though] – Spacedman Oct 21 '13 at 09:05

1 Answers1

3

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

alexis_laz
  • 12,884
  • 4
  • 27
  • 37