Question

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")
Was it helpful?

Solution 2

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")

OTHER TIPS

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.

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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top