Spie charts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Spie charts

Mag. Ferri Leberl
Dear ∀,
Ist there a function to plot "spie charts" in R?
https://en.wikipedia.org/wiki/spie_chart
(These are a combination of pie charts and radial pie charts, where the angle represents one dimension and the radius of the respective sector another dimension)
Thank you in advance!

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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: Spie charts

Bert Gunter-2
Probably not, for good reason (see remarks below), but you might search on
"nightingale plots"



****off topic remarks:****
The reason they are a bad idea (imo!) is that the eye is not good at
comparing angles, and this complicates the comparisons by adding radii, and
hence sector areas, into the mix. The example you linked to is nonsense: so
few numbers should not be graphed at all, because a simple table can be
easily and accurately comprehended.

For 2-d quantitative comparisons, a simple scatterplot is much more
effective at conveying the information accurately, assuming there's more
information than can be easily grasped in a small table.

Feel free to address responses and criticisms to me/ Ferri off list. I only
kept my remarks on list so that others could offer their possibly different
perspectives.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sun, Mar 28, 2021 at 8:59 AM Ferri Leberl <[hidden email]> wrote:

> Dear ∀,
> Ist there a function to plot "spie charts" in R?
> https://en.wikipedia.org/wiki/spie_chart
> (These are a combination of pie charts and radial pie charts, where the
> angle represents one dimension and the radius of the respective sector
> another dimension)
> Thank you in advance!
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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: Spie charts

Jim Lemon-4
In reply to this post by Mag. Ferri Leberl
Hi Ferri,
There are a number of variations on the pie chart. The fan.plot,
radial.pie and starPie functions in the plotrix package are but a few.
There are two really important considerations in using plots like
this:

1) Does the plot illustrate what you want? For example, if you want to
show that more of the A people get COVID than B people, but also that
there are more of them in the population, you could probably do this
with what you are suggesting.

2) Do the viewers get it? This is the most important part. You know
what is happening, but is that information clear to the viewer. Try it
out on unsuspecting co-workers without explanation.

Bert is right, Florence Nightingale's "coxcomb" is an early attempt at
doing this sort of thing.

Jim

On Mon, Mar 29, 2021 at 2:59 AM Ferri Leberl <[hidden email]> wrote:

>
> Dear ∀,
> Ist there a function to plot "spie charts" in R?
> https://en.wikipedia.org/wiki/spie_chart
> (These are a combination of pie charts and radial pie charts, where the angle represents one dimension and the radius of the respective sector another dimension)
> Thank you in advance!
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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: Spie charts

aBBy Spurdle, ⍺XY
In reply to this post by Mag. Ferri Leberl
I couldn't find a predefined function for this purpose.
However, it wouldn't be too difficult to write a pair of functions.

The big question is how flexible does the rendering function need to be?

#plot from angles, distances, etc
#(angles on arbitrary scale)
spiechart.render <- function (
    angle=1, distance, ...,
    circd= stdd, labd = 1.25 * stdd,
    main="", labs="", line.col="black", area.col="white",
    stdd = mean (distance) )
{   n <- length (distance)
    angle <- rep_len (angle, n)
    angle <- 2 * pi * angle / sum (angle)
    <rest of code>
}

#compute angles and distances, from data
#(then call rendering function)
spiechart <- function (
    <rest of code>
    spiechart.render (angle, distance, ...)
}

Partially off-topic remarks:
I know there's some criticism of this approach.
However, the OP never stated the purpose.
And this approach could be useful in some cases.
Say for modelling certain ecological or weather events.
Where for each event, there's a categorical date (such as month) and a
magnitude/etc.
And then, in the top level function from above, the angles and
distances would be the result of aggregation functions.


On Mon, Mar 29, 2021 at 4:59 AM Ferri Leberl <[hidden email]> wrote:

>
> Dear ∀,
> Ist there a function to plot "spie charts" in R?
> https://en.wikipedia.org/wiki/spie_chart
> (These are a combination of pie charts and radial pie charts, where the angle represents one dimension and the radius of the respective sector another dimension)
> Thank you in advance!
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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: Spie charts

Jim Lemon-4
Hi Abby,
Have a look at the first example in the radial.pie function (plotrix).

Jim

On Tue, Mar 30, 2021 at 7:59 AM Abby Spurdle <[hidden email]> wrote:

>
> I couldn't find a predefined function for this purpose.
> However, it wouldn't be too difficult to write a pair of functions.
>
> The big question is how flexible does the rendering function need to be?
>
> #plot from angles, distances, etc
> #(angles on arbitrary scale)
> spiechart.render <- function (
>     angle=1, distance, ...,
>     circd= stdd, labd = 1.25 * stdd,
>     main="", labs="", line.col="black", area.col="white",
>     stdd = mean (distance) )
> {   n <- length (distance)
>     angle <- rep_len (angle, n)
>     angle <- 2 * pi * angle / sum (angle)
>     <rest of code>
> }
>
> #compute angles and distances, from data
> #(then call rendering function)
> spiechart <- function (
>     <rest of code>
>     spiechart.render (angle, distance, ...)
> }
>
> Partially off-topic remarks:
> I know there's some criticism of this approach.
> However, the OP never stated the purpose.
> And this approach could be useful in some cases.
> Say for modelling certain ecological or weather events.
> Where for each event, there's a categorical date (such as month) and a
> magnitude/etc.
> And then, in the top level function from above, the angles and
> distances would be the result of aggregation functions.
>
>
> On Mon, Mar 29, 2021 at 4:59 AM Ferri Leberl <[hidden email]> wrote:
> >
> > Dear ∀,
> > Ist there a function to plot "spie charts" in R?
> > https://en.wikipedia.org/wiki/spie_chart
> > (These are a combination of pie charts and radial pie charts, where the angle represents one dimension and the radius of the respective sector another dimension)
> > Thank you in advance!
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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 -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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: Spie charts

Jim Lemon-4
In reply to this post by Mag. Ferri Leberl
Hi Ferri,
Just for fun, I plotted six countries with the current COVID deaths,
per million against both population and median income. Even I was
surprised.

library(plotrix)
country<-c("USA","Brazil","India","UK","Czechia","Mexico")
COVIDdeath<-c(1694,1471,117,1858,2445,1553)
Countrypop<-c(332,214,1390,68,11,130)
poprad<-rescale(cumsum(c(0,Countrypop)),c(0,2*pi))
median_income<-c(65850,9130,2120,42220,21940,9480)
png("COVID_death_by_pop.png")
radial.pie(radial.extents=COVIDdeath,
 sector.edges=poprad,
 sector.colors=color.scale(median_income,extremes=c("red","green")),
 labels=country,radial.lim=c(0,2500))
color.legend(xl=-2600,yb=-2600,xr=500,yt=-2500,
 legend=seq(2000,66000,length.out=5),
 rect.col=color.scale(seq(2000,66000,length.out=5),extremes=c("red","green")))
text(0,2850,"COVID deaths per million population",xpd=TRUE)
text(-1095,-2700,"Median income USD",xpd=TRUE)
text(2000,-2600,"Sector angle = population",xpd=TRUE)
dev.off()


Jim

On Mon, Mar 29, 2021 at 2:59 AM Ferri Leberl <[hidden email]> wrote:

>
> Dear ∀,
> Ist there a function to plot "spie charts" in R?
> https://en.wikipedia.org/wiki/spie_chart
> (These are a combination of pie charts and radial pie charts, where the angle represents one dimension and the radius of the respective sector another dimension)
> Thank you in advance!
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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 -- To UNSUBSCRIBE and more, see
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.

COVID_death_by_pop.png (53K) Download Attachment