0

In plotrix I would like to make a pie chart like this:

 pieval<-c(2,4,6,8)
 pielabels<- c("We hate\n pies","We oppose\n  pies","We don't\n  care","We just love pies")

 lp<-pie3D(pieval,radius=0.9,labels=pielabels,explode=0.1,main="3D PIE OPINIONS")

And I would like only the pie piece corresponding to "We just love pies" to show up, which should give something like this:

photoshoped pie chart piece

But of course I fail to make it because I use this code:

lp<-pie3D(pieval[4],radius=0.9,labels=pielabels[4],explode=0.1,main="3D PIE OPINIONS")
Mehdi Nellen
  • 8,486
  • 4
  • 33
  • 48
  • 5
    Please don't use pie charts. Especially not in 3d. – Thomas Feb 20 '14 at 10:46
  • could you explain why? – Mehdi Nellen Feb 20 '14 at 10:49
  • 2
    Plots like this need to convey comparisons of a statistic across groups or categories. Line lengths or areas of similar shape are cognitively easy to compare. Pie charts ask you to compare areas of differently shaped objects, which is much harder. When turned into 3D, the plot is further distorted because the actual displayed area of each segment is not a smooth function of the original data. Say the area of one "slice" is 30%, when put in 3D perspective it might appear to only be 20% (the slices in the "back" of the plot are distorted to appear proportionately smaller than they actually are). – Thomas Feb 20 '14 at 10:52
  • yes, that is true but I use the graph just for a fancy representation. In my real data set I show the percentages of each of the slices in the labels. I also use a higher viewing angle, which should reduce this effect. But I left all these things away in this example because it would make the code look messy and it doesn't add anything to the problem. – Mehdi Nellen Feb 20 '14 at 11:00
  • What is the use of presenting the data graphically if you present raw numbers? I understand you may be pressured by people who cut your bread to make things fancy, and I don't know the way out of it other than flipping them off or referring them to a statistician. – Roman Luštrik Feb 20 '14 at 11:06
  • 2
    guys this is off topic! It's not important whose telling me to make this or what it's for. My question is concrete. – Mehdi Nellen Feb 20 '14 at 11:14

3 Answers3

2

If you just want to draw one 3d tilted pie sector, use draw.tilted.sector.

Display a 3D pie sector

Description:

     Displays a 3D pie sector.

I did experiment with setting the colour and border colour of pie segments to NA but I couldn't get rid of the shading.

But as expressed in comments, only use 3d pies if you are making a comment about how poor 3d pie charts are.

Spacedman
  • 92,590
  • 12
  • 140
  • 224
0

I used the draw.tilted.sector suggested by this answer. I managed to get rid of all the shading, borderlines and sectors by making them white.

pieval    <- c(2,4,6,8)
pielabels <- c("","","","We just love pies")

#make everything white 
lp <-pie3D(pieval,radius=0.9,labels=pielabels,explode=0.1,
           main="3D PIE OPINIONS", col= "white", shade =0, border="white")

#draw the sector
draw.tilted.sector(start = (24/20)*pi, end = 2*pi, 
                   radius= 0.9, explode =0.1, col= "purple")
Community
  • 1
  • 1
Mehdi Nellen
  • 8,486
  • 4
  • 33
  • 48
0

Instead you can use sector.order to display any sector according to your choice. For this case you can use

pie3D(pieval, radius=2, labels="We hate\n pies", explode=0.1, main="3D PIE OPINIONS", col=c("brown", "#ddaa00", "pink", "#dd00dd"), sector.order = 4)
Mayank Diwedi
  • 191
  • 1
  • 2
  • 7