0 down vote favorite I am working on R and trying to draw a clock using a pie chart. code: pie(c(25,20,15,10,10,30),labels = c(1,2,3,4,5,6,7,8,9,10,11,12), col=rainbow(length(lbls)), clockwise = TRUE, init.angle = 90) but i need all 12 labels to be there independent of no of segments in input. http://r.789695.n4.nabble.com/file/n4639721/Screenshot-7.png How can i implement it? -- View this message in context: http://r.789695.n4.nabble.com/How-to-draw-clock-in-R-tp4639721.html Sent from the R help mailing list archive at Nabble.com.
On 08/09/2012 03:43 PM, Manish Gupta wrote:> 0 down vote favorite > > > I am working on R and trying to draw a clock using a pie chart. > > code: > > pie(c(25,20,15,10,10,30),labels = c(1,2,3,4,5,6,7,8,9,10,11,12), > col=rainbow(length(lbls)), clockwise = TRUE, init.angle = 90) > > but i need all 12 labels to be there independent of no of segments in input. > > http://r.789695.n4.nabble.com/file/n4639721/Screenshot-7.png > > How can i implement it? >Hi Manish, library(plotrix) pie(c(25,20,15,10,10,30)) floating.pie(0,0,c(25,20,15,10,10,30)) pie.labels(0,0,seq(0,23*pi/12,by=pi/6),c(3:1,12:4), radius=1.1,border=NA) Jim
Great! It works fine for me. But i have one query. In my clock i have only 10 points so i am using as follows. pie(c(25,20,15,10,10,30)) floating.pie(0,0,c(25,20,15,10,10,30)) pie.labels(0,0,seq(0,19*pi/10,by=pi/5),c(3,2,1,0,9,8,7,6,5,4)*10,radius=1.1,border=NA) But format is not correct. I tried a lot but 0 always comes in beyond center. http://r.789695.n4.nabble.com/file/n4639746/Untitled.png -- View this message in context: http://r.789695.n4.nabble.com/How-to-draw-clock-in-R-tp4639721p4639746.html Sent from the R help mailing list archive at Nabble.com.
On 08/09/2012 08:58 PM, Manish Gupta wrote:> Great! It works fine for me. But i have one query. In my clock i have only 10 > points so i am using as follows. > > pie(c(25,20,15,10,10,30)) > floating.pie(0,0,c(25,20,15,10,10,30)) > pie.labels(0,0,seq(0,19*pi/10,by=pi/5),c(3,2,1,0,9,8,7,6,5,4)*10,radius=1.1,border=NA) > > > But format is not correct. I tried a lot but 0 always comes in beyond > center. >Hi Manish, As the circumferential positions start at the right side, you will have to arrange your angles something like this: # untested pie.labels(0,0,seq(pi/10,19*pi/10,by=pi/5), c(2,1,0,9,8,7,6,5,4,3)*10,radius=1.1,border=NA) Jim
Clock always start from 0 which means first slice should start from 0 and subsequent slices should be added clockwise but here they are added anticlockwise. Is there any parameter so that i can make them clockwise? library(plotrix) pie(c(25,20,15,10,10,30)) floating.pie(0,0,c(25,20,15,10,10,30),start=7.877) #How to add clockwise option here? pie.labels(0,0,seq(pi/10,19*pi/10,by=pi/5), c(2,1,0,9,8,7,6,5,4,3)*10,radius=1.2,border=NA) Regards -- View this message in context: http://r.789695.n4.nabble.com/How-to-draw-clock-in-R-tp4639721p4639839.html Sent from the R help mailing list archive at Nabble.com.