[R] pie3D labelpos

Jim Lemon jim at bitwrit.com.au
Sat Jun 19 08:04:36 CEST 2010


On 06/18/2010 11:58 PM, Tiffany Vidal wrote:
> Hello,
>
> I'm trying to make a 3D pie chart, but my labels are overlapping. I see
> that labelpos could offer a solution to this, but I have been unable to
> find any code snippets that indicate what type of value this argument
> requires. Any guidance would be appreciated!
>
Hi Tiffany,
Labels are placed at the "middle" of each sector of the pie by default. 
The easiest way to change the position of one label is to capture the 
return value of pie3D, which is the position of the labels in radians 
(using the example):

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

You can then see where the labels have been placed:

bc
[1] 0.3141593 1.2566371 2.8274334 5.0265482

You can change the positions like this:

bc[4]<-4.5
pie3D(pieval,radius=0.9,labels=pielabels,explode=0.1,
  main="3D PIE OPINIONS",labelpos=bc)

Jim



More information about the R-help mailing list