# squared "pie chart" - is there such a thing?

17 messages
Open this post in threaded view
|

## squared "pie chart" - is there such a thing?

 Hello! It's a shoot in the dark, but I'll try. If one has a total of 100 (e.g., %), and three components of the total, e.g., mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with 3 sectors representing x, y, and z according to their proportions in the total. I am wondering if it's possible to build something very similar, but not on a circle but in a square - such that the total area of the square is the sum of the components and the components (x, y, and z) are represented on a square as shapes with right angles (squares, rectangles, L-shapes, etc.). I realize there are many possible positions and shapes - even for 3 components. But I don't really care where components are located within the square - as long as they are there. Is there a package that could do something like that? Thanks a lot! -- Dimitri Liakhovitski marketfusionanalytics.com ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 This is called a squarified pie chart or a waffle chart (if you want to keep the food metaphor going): http://eagereyes.org/communication/Engaging-readers-with-square-pie-waffle-charts.htmlHadley On Thu, Jul 21, 2011 at 10:29 AM, Dimitri Liakhovitski <[hidden email]> wrote: > Hello! > It's a shoot in the dark, but I'll try. If one has a total of 100 > (e.g., %), and three components of the total, e.g., > mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with > 3 sectors representing x, y, and z according to their proportions in > the total. > I am wondering if it's possible to build something very similar, but > not on a circle but in a square - such that the total area of the > square is the sum of the components and the components (x, y, and z) > are represented on a square as shapes with right angles (squares, > rectangles, L-shapes, etc.). I realize there are many possible > positions and shapes - even for 3 components. But I don't really care > where components are located within the square - as long as they are > there. > > Is there a package that could do something like that? > Thanks a lot! > > -- > Dimitri Liakhovitski > marketfusionanalytics.com > > ______________________________________________ > [hidden email] 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. > -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 In reply to this post by Dimitri Liakhovitski-2 It's more complex than what you describe, but what about a mosaic plot? http://conprogram.weebly.com/program-schedule.htmlThey're very useful, and much better than pie charts because they don't rely on the visual estimation of angles, something people aren't very good at. Sarah On Thu, Jul 21, 2011 at 11:29 AM, Dimitri Liakhovitski <[hidden email]> wrote: > Hello! > It's a shoot in the dark, but I'll try. If one has a total of 100 > (e.g., %), and three components of the total, e.g., > mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with > 3 sectors representing x, y, and z according to their proportions in > the total. > I am wondering if it's possible to build something very similar, but > not on a circle but in a square - such that the total area of the > square is the sum of the components and the components (x, y, and z) > are represented on a square as shapes with right angles (squares, > rectangles, L-shapes, etc.). I realize there are many possible > positions and shapes - even for 3 components. But I don't really care > where components are located within the square - as long as they are > there. > > Is there a package that could do something like that? > Thanks a lot! > > -- > Dimitri Liakhovitski > marketfusionanalytics.com > -- Sarah Goslee http://www.functionaldiversity.org______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 In reply to this post by Hadley Wickham-2 I tried the mosaic chart: mytotal=data.frame(x=50,y=30,z=20) require(stats) mosaicplot(mytotal1) It's good, but it only creates rectangles that are stacked on top of each other, which is not exactly what I was looking for. Is there a R package for waffle chart? I tried help.search("waffle") and found nothing. Also nothing on Google... Thanks! Dimitri On Thu, Jul 21, 2011 at 11:33 AM, Hadley Wickham <[hidden email]> wrote: > This is called a squarified pie chart or a waffle chart (if you want > to keep the food metaphor going): > http://eagereyes.org/communication/Engaging-readers-with-square-pie-waffle-charts.html> > Hadley > > > On Thu, Jul 21, 2011 at 10:29 AM, Dimitri Liakhovitski > <[hidden email]> wrote: >> Hello! >> It's a shoot in the dark, but I'll try. If one has a total of 100 >> (e.g., %), and three components of the total, e.g., >> mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with >> 3 sectors representing x, y, and z according to their proportions in >> the total. >> I am wondering if it's possible to build something very similar, but >> not on a circle but in a square - such that the total area of the >> square is the sum of the components and the components (x, y, and z) >> are represented on a square as shapes with right angles (squares, >> rectangles, L-shapes, etc.). I realize there are many possible >> positions and shapes - even for 3 components. But I don't really care >> where components are located within the square - as long as they are >> there. >> >> Is there a package that could do something like that? >> Thanks a lot! >> >> -- >> Dimitri Liakhovitski >> marketfusionanalytics.com >> >> ______________________________________________ >> [hidden email] 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. >> > > > > -- > Assistant Professor / Dobelman Family Junior Chair > Department of Statistics / Rice University > http://had.co.nz/> -- Dimitri Liakhovitski marketfusionanalytics.com ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 On Thu, Jul 21, 2011 at 12:06 PM, Dimitri Liakhovitski <[hidden email]> wrote: > I tried the mosaic chart: > > mytotal=data.frame(x=50,y=30,z=20) > require(stats) > mosaicplot(mytotal1) > > It's good, but it only creates rectangles that are stacked on top of > each other, which is not exactly what I was looking for. Because that's what you specified. Compare these: mosaicplot(matrix(c(50, 30, 20, 0), 2, 2)) mosaicplot(matrix(c(0, 50, 20, 30), 2, 2)) > Is there a R package for waffle chart? > I tried help.search("waffle") and found nothing. Also nothing on Google... You might also find the R Graph Gallery helpful; you can browse many different types of plots there, and might find what you are thinking of. http://addictedtor.free.fr/graphiques/Sarah > Thanks! > Dimitri > > On Thu, Jul 21, 2011 at 11:33 AM, Hadley Wickham <[hidden email]> wrote: >> This is called a squarified pie chart or a waffle chart (if you want >> to keep the food metaphor going): >> http://eagereyes.org/communication/Engaging-readers-with-square-pie-waffle-charts.html>> >> Hadley >> >> >> On Thu, Jul 21, 2011 at 10:29 AM, Dimitri Liakhovitski >> <[hidden email]> wrote: >>> Hello! >>> It's a shoot in the dark, but I'll try. If one has a total of 100 >>> (e.g., %), and three components of the total, e.g., >>> mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with >>> 3 sectors representing x, y, and z according to their proportions in >>> the total. >>> I am wondering if it's possible to build something very similar, but >>> not on a circle but in a square - such that the total area of the >>> square is the sum of the components and the components (x, y, and z) >>> are represented on a square as shapes with right angles (squares, >>> rectangles, L-shapes, etc.). I realize there are many possible >>> positions and shapes - even for 3 components. But I don't really care >>> where components are located within the square - as long as they are >>> there. >>> >>> Is there a package that could do something like that? -- Sarah Goslee http://www.functionaldiversity.org______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 Thanks a lot, Sarah. I am definitely going to explore. A quick question about mosaicplot(matrix(c(50, 30, 20, 0), 2, 2)) mosaicplot(matrix(c(0, 50, 20, 30), 2, 2)) What are the numbers that appear on the graphs (2.1, 2.2,1.1,1.2)? Dimitri On Thu, Jul 21, 2011 at 12:20 PM, Sarah Goslee <[hidden email]> wrote: > On Thu, Jul 21, 2011 at 12:06 PM, Dimitri Liakhovitski > <[hidden email]> wrote: >> I tried the mosaic chart: >> >> mytotal=data.frame(x=50,y=30,z=20) >> require(stats) >> mosaicplot(mytotal1) >> >> It's good, but it only creates rectangles that are stacked on top of >> each other, which is not exactly what I was looking for. > > Because that's what you specified. Compare these: > mosaicplot(matrix(c(50, 30, 20, 0), 2, 2)) > mosaicplot(matrix(c(0, 50, 20, 30), 2, 2)) > >> Is there a R package for waffle chart? >> I tried help.search("waffle") and found nothing. Also nothing on Google... > > You might also find the R Graph Gallery helpful; you can browse many > different types of plots there, and might find what you are thinking > of. > http://addictedtor.free.fr/graphiques/> > Sarah > > >> Thanks! >> Dimitri >> >> On Thu, Jul 21, 2011 at 11:33 AM, Hadley Wickham <[hidden email]> wrote: >>> This is called a squarified pie chart or a waffle chart (if you want >>> to keep the food metaphor going): >>> http://eagereyes.org/communication/Engaging-readers-with-square-pie-waffle-charts.html>>> >>> Hadley >>> >>> >>> On Thu, Jul 21, 2011 at 10:29 AM, Dimitri Liakhovitski >>> <[hidden email]> wrote: >>>> Hello! >>>> It's a shoot in the dark, but I'll try. If one has a total of 100 >>>> (e.g., %), and three components of the total, e.g., >>>> mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with >>>> 3 sectors representing x, y, and z according to their proportions in >>>> the total. >>>> I am wondering if it's possible to build something very similar, but >>>> not on a circle but in a square - such that the total area of the >>>> square is the sum of the components and the components (x, y, and z) >>>> are represented on a square as shapes with right angles (squares, >>>> rectangles, L-shapes, etc.). I realize there are many possible >>>> positions and shapes - even for 3 components. But I don't really care >>>> where components are located within the square - as long as they are >>>> there. >>>> >>>> Is there a package that could do something like that? > > -- > Sarah Goslee > http://www.functionaldiversity.org> -- Dimitri Liakhovitski marketfusionanalytics.com ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 On Thu, Jul 21, 2011 at 12:33 PM, Dimitri Liakhovitski <[hidden email]> wrote: > Thanks a lot, Sarah. > I am definitely going to explore. > A quick question about > mosaicplot(matrix(c(50, 30, 20, 0), 2, 2)) > mosaicplot(matrix(c(0, 50, 20, 30), 2, 2)) > > What are the numbers that appear on the graphs (2.1, 2.2,1.1,1.2)? > Dimitri > mosaicplot() actually expects a contingency table, so those are the purported group memberships. The resulting boxes are proportional to the cells, which is what you wanted, even though you aren't using it in the intended way. That's also why there's a mark to show the 0 cell in the matrix. Where mosaicplot() starts to really become interesting is when you have multiple-dimension contingency plots. But for your purpose, you can just have a two-dimensional matrix of numbers, and mosaicplot() will draw a corresponding set of proportionally-sized rectangles. Sarah -- Sarah Goslee http://www.functionaldiversity.org______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 In reply to this post by Dimitri Liakhovitski-2 On Thu, Jul 21, 2011 at 11:29 AM, Dimitri Liakhovitski <[hidden email]> wrote: > Hello! > It's a shoot in the dark, but I'll try. If one has a total of 100 > (e.g., %), and three components of the total, e.g., > mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with > 3 sectors representing x, y, and z according to their proportions in > the total. > I am wondering if it's possible to build something very similar, but > not on a circle but in a square - such that the total area of the > square is the sum of the components and the components (x, y, and z) > are represented on a square as shapes with right angles (squares, > rectangles, L-shapes, etc.). I realize there are many possible > positions and shapes - even for 3 components. But I don't really care > where components are located within the square - as long as they are > there. > > Is there a package that could do something like that? > Thanks a lot! Check out the treemap package. See the bottom of this page for examples: http://www.oga-lab.net/RGM2/func.php?rd_id=treemap:treemap-package-- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 In reply to this post by Dimitri Liakhovitski-2 Hello! It's a shoot in the dark, but I'll try. If one has a total of 100 (e.g., %), and three components of the total, e.g., mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with 3 sectors representing x, y, and z according to their proportions in the total. I am wondering if it's possible to build something very similar, but not on a circle but in a square - such that the total area of the square is the sum of the components and the components (x, y, and z) are represented on a square as shapes with right angles (squares, rectangles, L-shapes, etc.). I realize there are many possible positions and shapes - even for 3 components. But I don't really care where components are located within the square - as long as they are there. Is there a package that could do something like that? Thanks a lot! ----- I included waffle charts in Creating More Effective Graphs. The reaction was very negative; many readers let me know that they didn't like them. To create them I just drew a table in Word with 10 rows and 10 columns. Then I shaded the backgrounds of cells so for your example we would shade 50 cells one color, 30 another, and 20 a third color. Naomi ------------- Naomi B. Robbins 11 Christine Court Wayne, NJ 07470 973-694-6009 [hidden email] http://www.nbr-graphs.comAuthor of Creating More Effective Graphs //         [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 How about just a stacked bar plot? barplot(matrix(c(3,5,3),3,1),horiz=T,beside=F) Tom On Fri, Jul 22, 2011 at 7:14 AM, Naomi Robbins <[hidden email]> wrote: > > Hello! > It's a shoot in the dark, but I'll try. If one has a total of 100 > (e.g., %), and three components of the total, e.g., > mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with > 3 sectors representing x, y, and z according to their proportions in > the total. > I am wondering if it's possible to build something very similar, but > not on a circle but in a square - such that the total area of the > square is the sum of the components and the components (x, y, and z) > are represented on a square as shapes with right angles (squares, > rectangles, L-shapes, etc.). I realize there are many possible > positions and shapes - even for 3 components. But I don't really care > where components are located within the square - as long as they are > there. > > Is there a package that could do something like that? > Thanks a lot! > > ----- > > I included waffle charts in Creating More Effective Graphs. > The reaction was very negative; many readers let me know > that they didn't like them. To create them I just drew a table > in Word with 10 rows and 10 columns. Then I shaded the > backgrounds of cells so for your example we would shade > 50 cells one color, 30 another, and 20 a third color. > > Naomi > > ------------- > > > Naomi B. Robbins > 11 Christine Court > Wayne, NJ 07470 > 973-694-6009 > > [hidden email] > > http://www.nbr-graphs.com> > Author of Creating More Effective Graphs > > > // > > > > Â  Â  Â  Â [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 I don't usually use stacked bar charts since it is difficult to compare lengths that don't have a common baseline. Naomi On 7/23/2011 11:14 PM, Thomas Levine wrote: > How about just a stacked bar plot? > > barplot(matrix(c(3,5,3),3,1),horiz=T,beside=F) > > Tom > > On Fri, Jul 22, 2011 at 7:14 AM, Naomi Robbins<[hidden email]>  wrote: >> Hello! >> It's a shoot in the dark, but I'll try. If one has a total of 100 >> (e.g., %), and three components of the total, e.g., >> mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with >> 3 sectors representing x, y, and z according to their proportions in >> the total. >> I am wondering if it's possible to build something very similar, but >> not on a circle but in a square - such that the total area of the >> square is the sum of the components and the components (x, y, and z) >> are represented on a square as shapes with right angles (squares, >> rectangles, L-shapes, etc.). I realize there are many possible >> positions and shapes - even for 3 components. But I don't really care >> where components are located within the square - as long as they are >> there. >> >> Is there a package that could do something like that? >> Thanks a lot! >> >> ----- >> >> I included waffle charts in Creating More Effective Graphs. >> The reaction was very negative; many readers let me know >> that they didn't like them. To create them I just drew a table >> in Word with 10 rows and 10 columns. Then I shaded the >> backgrounds of cells so for your example we would shade >> 50 cells one color, 30 another, and 20 a third color. >> >> Naomi >> >> ------------- >> >> >> Naomi B. Robbins >> 11 Christine Court >> Wayne, NJ 07470 >> 973-694-6009 >> >> [hidden email] >> >> http://www.nbr-graphs.com>> >> Author of Creating More Effective Graphs >> >> >> // >> >> >> >>         [[alternative HTML version deleted]] >> >> ______________________________________________ >> [hidden email] 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. > -- -- Naomi B. Robbins NBR 11 Christine Court Wayne, NJ 07470 Phone:  (973) 694-6009 [hidden email] http://www.nbr-graphs.com  Follow me at http://www.twitter.com/nbrgraphsAuthor of /Creating More Effective Graphs /         [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 Has anyone suggested mosaic displays?  That's the closest I can think of as a "square pie chart"... > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Naomi Robbins > Sent: Sunday, July 24, 2011 7:09 AM > To: Thomas Levine > Cc: [hidden email] > Subject: Re: [R] squared "pie chart" - is there such a thing? > > I don't usually use stacked bar charts since it is difficult > to compare > lengths that don't have > a common baseline. > > Naomi > > On 7/23/2011 11:14 PM, Thomas Levine wrote: > > How about just a stacked bar plot? > > > > barplot(matrix(c(3,5,3),3,1),horiz=T,beside=F) > > > > Tom > > > > On Fri, Jul 22, 2011 at 7:14 AM, Naomi > Robbins<[hidden email]>  wrote: > >> Hello! > >> It's a shoot in the dark, but I'll try. If one has a total of 100 > >> (e.g., %), and three components of the total, e.g., > >> mytotal=data.frame(x=50,y=30,z=20), - one could build a > pie chart with > >> 3 sectors representing x, y, and z according to their > proportions in > >> the total. > >> I am wondering if it's possible to build something very > similar, but > >> not on a circle but in a square - such that the total area of the > >> square is the sum of the components and the components (x, > y, and z) > >> are represented on a square as shapes with right angles (squares, > >> rectangles, L-shapes, etc.). I realize there are many possible > >> positions and shapes - even for 3 components. But I don't > really care > >> where components are located within the square - as long > as they are > >> there. > >> > >> Is there a package that could do something like that? > >> Thanks a lot! > >> > >> ----- > >> > >> I included waffle charts in Creating More Effective Graphs. > >> The reaction was very negative; many readers let me know > >> that they didn't like them. To create them I just drew a table > >> in Word with 10 rows and 10 columns. Then I shaded the > >> backgrounds of cells so for your example we would shade > >> 50 cells one color, 30 another, and 20 a third color. > >> > >> Naomi > >> > >> ------------- > >> > >> > >> Naomi B. Robbins > >> 11 Christine Court > >> Wayne, NJ 07470 > >> 973-694-6009 > >> > >> [hidden email] > >> > >> http://www.nbr-graphs.com> >> > >> Author of Creating More Effective Graphs > >> > >> > >> // > >> > >> > >> > >>         [[alternative HTML version deleted]] > >> > >> ______________________________________________ > >> [hidden email] 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. > > > > > -- > > -- > > Naomi B. Robbins > > NBR > > 11 Christine Court > > Wayne, NJ 07470 > > Phone:  (973) 694-6009 > > [hidden email] > > http://www.nbr-graphs.com  > > Follow me at http://www.twitter.com/nbrgraphs> > Author of /Creating More Effective Graphs > / > > > [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] 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. > Notice:  This e-mail message, together with any attachme...{{dropped:11}} ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 Andy, Mosaic plots were suggested by Sarah Goslee on July 21st. Unfortunately, I broke the chain of messages when I was away from home, in a rush and didn't know how to respond to messages from a digest. Naomi -- Naomi B. Robbins NBR 11 Christine Court Wayne, NJ 07470 Phone:  (973) 694-6009 [hidden email] http://www.nbr-graphs.com  Follow me at http://www.twitter.com/nbrgraphsAuthor of /Creating More Effective Graphs / On 7/25/2011 11:28 AM, Liaw, Andy wrote: > Has anyone suggested mosaic displays?  That's the closest I can think of as a "square pie chart"... > >> -----Original Message----- >> From: [hidden email] >> [mailto:[hidden email]] On Behalf Of Naomi Robbins >> Sent: Sunday, July 24, 2011 7:09 AM >> To: Thomas Levine >> Cc: [hidden email] >> Subject: Re: [R] squared "pie chart" - is there such a thing? >> >> I don't usually use stacked bar charts since it is difficult >> to compare >> lengths that don't have >> a common baseline. >> >> Naomi >> >> On 7/23/2011 11:14 PM, Thomas Levine wrote: >>> How about just a stacked bar plot? >>> >>> barplot(matrix(c(3,5,3),3,1),horiz=T,beside=F) >>> >>> Tom >>> >>> On Fri, Jul 22, 2011 at 7:14 AM, Naomi >> Robbins<[hidden email]>   wrote: >>>> Hello! >>>> It's a shoot in the dark, but I'll try. If one has a total of 100 >>>> (e.g., %), and three components of the total, e.g., >>>> mytotal=data.frame(x=50,y=30,z=20), - one could build a >> pie chart with >>>> 3 sectors representing x, y, and z according to their >> proportions in >>>> the total. >>>> I am wondering if it's possible to build something very >> similar, but >>>> not on a circle but in a square - such that the total area of the >>>> square is the sum of the components and the components (x, >> y, and z) >>>> are represented on a square as shapes with right angles (squares, >>>> rectangles, L-shapes, etc.). I realize there are many possible >>>> positions and shapes - even for 3 components. But I don't >> really care >>>> where components are located within the square - as long >> as they are >>>> there. >>>> >>>> Is there a package that could do something like that? >>>> Thanks a lot! >>>> >>>> ----- >>>> >>>> I included waffle charts in Creating More Effective Graphs. >>>> The reaction was very negative; many readers let me know >>>> that they didn't like them. To create them I just drew a table >>>> in Word with 10 rows and 10 columns. Then I shaded the >>>> backgrounds of cells so for your example we would shade >>>> 50 cells one color, 30 another, and 20 a third color. >>>> >>>> Naomi >>>> >>>> ------------- >>>> >>>> >>>> Naomi B. Robbins >>>> 11 Christine Court >>>> Wayne, NJ 07470 >>>> 973-694-6009 >>>> >>>> [hidden email] >>>> >>>> http://www.nbr-graphs.com>>>> >>>> Author of Creating More Effective Graphs >>>> >>>> >>>> // >>>> >>>> >>>> >>>>          [[alternative HTML version deleted]] >>>> >>>> ______________________________________________ >>>> [hidden email] 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. >> >> -- >> >> -- >> >> Naomi B. Robbins >> >> NBR >> >> 11 Christine Court >> >> Wayne, NJ 07470 >> >> Phone:  (973) 694-6009 >> >> [hidden email] >> >> http://www.nbr-graphs.com >> >> Follow me at http://www.twitter.com/nbrgraphs>> >> Author of /Creating More Effective Graphs >> / >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> [hidden email] 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. >> > Notice:  This e-mail message, together with any attach...{{dropped:20}} ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

Open this post in threaded view
|

## Re: squared "pie chart" - is there such a thing?

 In reply to this post by Naomi B. Robbins On 07/26/2011 02:40 AM, Naomi Robbins wrote: > Hello! > It's a shoot in the dark, but I'll try. If one has a total of 100 > (e.g., %), and three components of the total, e.g., > mytotal=data.frame(x=50,y=30,z=20), - one could build a pie chart with > 3 sectors representing x, y, and z according to their proportions in > the total. > I am wondering if it's possible to build something very similar, but > not on a circle but in a square... Is this still going on? Okay, here's a square pie: squarePie<-function(slices,x0=0,y0=0,x1=1,y1=1,firstcall=TRUE,pos=1,   col=NULL,show.values=TRUE,...) {   sliceprop<-slices[1]/sum(slices)   if(firstcall) {    oldmar<-par(mar=c(2,2,3,2))    plot(0,xlim=c(0,1),ylim=c(0,1),xaxs="i",yaxs="i",type="n",axes=FALSE,     xlab="",ylab="",...)    if(is.null(col)) col=rainbow(length(slices))   }   if(pos == 1) {    ytop<-y0+(y1-y0)*sliceprop    rect(x0,y0,x1,ytop,col=col[1])    if(show.values) text((x0+x1)/2,(y0+ytop)/2,slices[1])    y0<-ytop   }   if(pos == 2) {    xright<-x0+(x1-x0)*sliceprop    rect(x0,y0,xright,y1,col=col[1])    if(show.values) text((x0+xright)/2,(y0+y1)/2,slices[1])    x0<-xright   }   if(pos == 3) {    ybottom<-y1-(y1-y0)*sliceprop    rect(x0,ybottom,x1,y1,col=col[1])    if(show.values) text((x0+x1)/2,(ybottom+y1)/2,slices[1])    y1<-ybottom   }   if(pos == 4) {    xleft<-x1-(x1-x0)*sliceprop    rect(xleft,y0,x1,y1,col=col[1])    if(show.values) text((xleft+x1)/2,(y0+y1)/2,slices[1])    x1<-xleft   }   pos<-ifelse(pos==4,1,pos+1)   if(length(slices > 1))    squarePie(slices[-1],x0,y0,x1,y1,firstcall=FALSE,pos=pos,col=col[-1])   if(firstcall) par(oldmar) } squarePie(c(4,3,6,2,5,1),main="A square meal from Oz") Jim ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.