Skip to content

display two pie-charts

4 messages · Lars, Barry Rowlingson, Romain Francois +1 more

#
Hey,

i'd like to compose a clock-like looking plot composed out of two 
circles, each showing the length of a period (to compare them). first, 
to do so, it looked the easiest by using pie(), just puting multiple 
pie-charts over each other. the problem is that once the second pie is 
drawn, it replaces the first one. does anybody know how to add a second, 
smaller pie over an existing one, like a layer?

thanks, lars
#
Lars wrote:

            
pie() calls plot.new(), thus creating a new plot. Comment out the 
plot.new call and you'll have a pie() function that splats over the 
current plot.

  Suggest you copy 'pie' to something of your own:

  > clock = pie

  Then edit the 'clock' function, removing the 'plot.new' call.

  All 'pie' does is call 'polygon' with some sine and cosine trickery - 
you may be better off writing your own graphics function to do what you 
want. Reading the 'pie' code may help!

Baz
#
Le 11.05.2005 15:43, Lars a ??crit :
Look at :

?layout
?par

And try :

par(mfrow=c(1,2))
pie(runif(4))
pie(runif(4))
#
Lars wrote:
Hi Lars,

You might be able to do what you want with either floating.pie() or 
clock24.plot() in the plotrix package. I can't try it out right now, but 
I'll have a look later today.

Jim