[R] Spie charts

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Tue Mar 30 01:28:53 CEST 2021

```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 <spurdle.a using gmail.com> 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 <ferri.leberl using gmx.at> 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!
> >
> > ______________________________________________
> > R-help using r-project.org 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.
>
> ______________________________________________
> R-help using r-project.org 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.

```