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

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

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

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!

--
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.
Reply | Threaded
Open this post in threaded view
|

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

Hadley Wickham-2
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/

______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|

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

Sarah Goslee
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.html

They'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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Dimitri Liakhovitski-2
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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Sarah Goslee
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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Dimitri Liakhovitski-2
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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Sarah Goslee
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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Gabor Grothendieck
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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Naomi B. Robbins
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] <mailto:[hidden email]>

http://www.nbr-graphs.com

Author of Creating More Effective Graphs
<http://www.nbr-graphs.com/bookframe.html>

//



        [[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.
Reply | Threaded
Open this post in threaded view
|

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

Thomas Levine
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] <mailto:[hidden email]>
>
> http://www.nbr-graphs.com
>
> Author of Creating More Effective Graphs
> <http://www.nbr-graphs.com/bookframe.html>
>
> //
>
>
>
>        [[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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Naomi B. Robbins
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]<mailto:[hidden email]>
>>
>> http://www.nbr-graphs.com
>>
>> Author of Creating More Effective Graphs
>> <http://www.nbr-graphs.com/bookframe.html>
>>
>> //
>>
>>
>>
>>         [[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] <mailto:[hidden email]>

http://www.nbr-graphs.com <http://www.nbr-graphs.com/>

Follow me at http://www.twitter.com/nbrgraphs

Author of /Creating More Effective Graphs
<http://www.nbr-graphs.com/bookframe.html>/


        [[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.
Reply | Threaded
Open this post in threaded view
|

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

Liaw, Andy
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]<mailto:[hidden email]>
> >>
> >> http://www.nbr-graphs.com
> >>
> >> Author of Creating More Effective Graphs
> >> <http://www.nbr-graphs.com/bookframe.html>
> >>
> >> //
> >>
> >>
> >>
> >>         [[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] <mailto:[hidden email]>
>
> http://www.nbr-graphs.com <http://www.nbr-graphs.com/>
>
> Follow me at http://www.twitter.com/nbrgraphs
>
> Author of /Creating More Effective Graphs
> <http://www.nbr-graphs.com/bookframe.html>/
>
>
> [[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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Naomi B. Robbins
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] <mailto:[hidden email]>
http://www.nbr-graphs.com <http://www.nbr-graphs.com/>
Follow me at http://www.twitter.com/nbrgraphs
Author of /Creating More Effective Graphs
<http://www.nbr-graphs.com/bookframe.html>/


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]<mailto:[hidden email]>
>>>>
>>>> http://www.nbr-graphs.com
>>>>
>>>> Author of Creating More Effective Graphs
>>>> <http://www.nbr-graphs.com/bookframe.html>
>>>>
>>>> //
>>>>
>>>>
>>>>
>>>>          [[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]<mailto:[hidden email]>
>>
>> http://www.nbr-graphs.com<http://www.nbr-graphs.com/>
>>
>> Follow me at http://www.twitter.com/nbrgraphs
>>
>> Author of /Creating More Effective Graphs
>> <http://www.nbr-graphs.com/bookframe.html>/
>>
>>
>> [[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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Ted Harding
Naomi,
You can reply to messages in a Digest provided you have set
your list options so that you choose "MIME" rather than
"Plain Text" for the option "Get MIME or Plain Text Digests?"
provded your email client supports MIME Digests.

In that case, when you open the Digest email, you will be
able to read each individual message separately, since each
one is attached as a separate attachment.

With Plain Text Digests, however, the messages are all strung
together as one long single email message, and cannot be
individually separated.

Hopoing this helps,
Ted.

On 25-Jul-11 16:40:25, Naomi Robbins wrote:

> 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] <mailto:[hidden email]>
> http://www.nbr-graphs.com <http://www.nbr-graphs.com/>
> Follow me at http://www.twitter.com/nbrgraphs
> Author of /Creating More Effective Graphs
> <http://www.nbr-graphs.com/bookframe.html>/
>
>
> 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]<mailto:[hidden email]>
>>>>>
>>>>> http://www.nbr-graphs.com
>>>>>
>>>>> Author of Creating More Effective Graphs
>>>>> <http://www.nbr-graphs.com/bookframe.html>
>>>>>
>>>>> //
>>>>>
>>>>>
>>>>>
>>>>>          [[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]<mailto:[hidden email]>
>>>
>>> http://www.nbr-graphs.com<http://www.nbr-graphs.com/>
>>>
>>> Follow me at http://www.twitter.com/nbrgraphs
>>>
>>> Author of /Creating More Effective Graphs
>>> <http://www.nbr-graphs.com/bookframe.html>/
>>>
>>>
>>>     [[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-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 26-Jul-11                                       Time: 08:04:51
------------------------------ XFMail ------------------------------

______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|

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

Jim Lemon
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-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

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

Ted Harding
On 26-Jul-11 11:26:14, Jim Lemon wrote:

> 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

A very nice implementation, Jim! However, its existence allows me
to test some perceptual concerns I have had about the "square pie
chart" concept -- not unlrelated to the one we all have about
ordinary pie charts, but somewhat different in nature.

Namely, it is interesting to comare the impressions one forms of:

  squarePie(c(10,9,8,7,6,5,4,3,2,1),main="A square meal from Oz")
  X11()
  squarePie(c(1,2,3,4,5,6,7,8,9,10),main="A square meal from Oz")

Possibly there may be scope for additional flexibility regarding
the order in which the rectangles are placed in the chart. I know
the user can select this by re-arranging 'slices', but maybe the
function itself could try to be "intelligent" about this (though
I'm at a loss at the moment to suggest what the basis for this
should be)!

Best wishes,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 26-Jul-11                                       Time: 13:03:43
------------------------------ XFMail ------------------------------

______________________________________________
[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.
Reply | Threaded
Open this post in threaded view
|

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

Ted Harding
[Follow-up -- see at end]

On 26-Jul-11 12:03:46, Ted Harding wrote:

> On 26-Jul-11 11:26:14, Jim Lemon wrote:
>> 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
>
> A very nice implementation, Jim! However, its existence allows me
> to test some perceptual concerns I have had about the "square pie
> chart" concept -- not unlrelated to the one we all have about
> ordinary pie charts, but somewhat different in nature.
>
> Namely, it is interesting to comare the impressions one forms of:
>
>   squarePie(c(10,9,8,7,6,5,4,3,2,1),main="A square meal from Oz")
>   X11()
>   squarePie(c(1,2,3,4,5,6,7,8,9,10),main="A square meal from Oz")
>
> Possibly there may be scope for additional flexibility regarding
> the order in which the rectangles are placed in the chart. I know
> the user can select this by re-arranging 'slices', but maybe the
> function itself could try to be "intelligent" about this (though
> I'm at a loss at the moment to suggest what the basis for this
> should be)!
>
> Best wishes,
> Ted.

And the comparison is even more interesting if (after the above)
you do:

  dev.set(2)
  # X11cairo
  #        2
  squarePie(c(5,1,2,7,3,10,4,6,8,9),main="A square meal from Oz")
  dev.set(3)
  # X11cairo
  #        3
  squarePie(rev(c(5,1,2,7,3,10,4,6,8,9)),main="A square meal from Oz")

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 26-Jul-11                                       Time: 13:49:03
------------------------------ XFMail ------------------------------

______________________________________________
[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.