An embedded and charset-unspecified text was scrubbed... Name: no disponible URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130524/1fa805dc/attachment.pl>
Pie chart
3 messages · Jose Narillos de Santos, Rui Barradas, Jim Lemon
Hello, Can you please use ?dput to post your data? The dataset you've posted doesn't make sense, you say you have 4 components but each row has 5 values, and that includes Group 9, which should have only 2 values (or 4 values with 2 zeros). Rui Barradas Em 24-05-2013 21:08, Jose Narillos de Santos escreveu:
I have a 8 Groups composed by A,B, c, D components. The Group 9 is composed by the 8 Groups but only components A and C. I want to chart a plot with 1 big plot of the total Groups (from 1 to 8) on the right and 8 mini pies on the left composed by the 4 components (the size of each pie of group should be bigger or smaller depending on the total). The same structure but below this plot I want to put on the left the plot of Group 9 composed by Component A and C and on the left 8 pies composed by Component B and C on Each Group. I don?t know if it is posible..... And If I have explain well... components Component A Component B Component C Component D Group 1 1100 1000 100 0 0 Group 2 728 380 38 10 300 Group 3 320 200 20 50 50 Group 4 110 80 8 20 2 Group 5 75 40 4 5 26 Group 6 38 30 3 2 3 Group 7 16 10 1 0 5 Group 8 10,5 5 0,5 4 1 Total 2397,5 1745 174,5 91 387 Group 9 1836 1745 0 91 0 [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
On 05/25/2013 06:08 AM, Jose Narillos de Santos wrote:
I have a 8 Groups composed by A,B, c, D components. The Group 9 is composed by the 8 Groups but only components A and C. I want to chart a plot with 1 big plot of the total Groups (from 1 to 8) on the right and 8 mini pies on the left composed by the 4 components (the size of each pie of group should be bigger or smaller depending on the total). The same structure but below this plot I want to put on the left the plot of Group 9 composed by Component A and C and on the left 8 pies composed by Component B and C on Each Group. I don?t know if it is posible.....
Hi Jose, Not only possible... Group1<-c(1100,1000,100) Group2<-c(728,380,38,10,300) Group3<-c(320,200,20,50,50) Group4<-c(110,80,8,20,2) Group5<-c(75,40,4,5,26) Group6<-c(38,30,3,2,3) Group7<-c(16,10,1,5) Group8<-c(10.5,5,0.5,4,1) Total<-c(2397.5,1745,174.5,91,387) Group9<-c(1836,1745,0,91,0) x11(width=10,height=5) par(mar=c(1,1,1,1)) plot(0,xlim=c(0,4),ylim=c(0,5),type="n",axes=FALSE) piecol<-2:6 require(plotrix) totalpos<-floating.pie(1,2.5,Total,col=piecol) pielab<-LETTERS[1:5] pie.labels(1,2.5,totalpos,pielab) g1pos<-floating.pie(2.3,4,Group1,radius=0.2,col=piecol) pie.labels(2.3,4,g1pos,pielab[1:3],radius=0.2) g2pos<-floating.pie(2.7,3,Group2,radius=0.2,col=piecol) pie.labels(2.7,3,g2pos,pielab,radius=0.2) g3pos<-floating.pie(2.3,2,Group3,radius=0.2,col=piecol) pie.labels(2.3,2,g3pos,pielab,radius=0.2) g4pos<-floating.pie(2.7,1,Group4,radius=0.2,col=piecol) pie.labels(2.7,1,g4pos,pielab,radius=0.2) g5pos<-floating.pie(3.3,4,Group5,radius=0.2,col=piecol) pie.labels(3.3,4,g5pos,pielab,radius=0.2) g6pos<-floating.pie(3.7,3,Group6,radius=0.2,col=piecol) pie.labels(3.7,3,g6pos,pielab,radius=0.2) g7pos<-floating.pie(3.3,2,Group7,radius=0.2,col=piecol[c(1:3,5)]) pie.labels(3.3,2,g7pos,pielab[c(1:3,5)],radius=0.2) g8pos<-floating.pie(3.7,1,Group8,radius=0.2,col=piecol) pie.labels(3.7,1,g8pos,pielab,radius=0.2) That should get you started. I think I will modify floating.pie so that it just ignores zero or NA values in the sector proportions. Jim