[R] Area Graphs

S Ellison S.Ellison at LGCGroup.com
Wed Jul 16 17:33:44 CEST 2014


> Is there a way to produce good quality area graphs in R? If so I would greatly
> appreciate being directed to the relevant package or a code example.

Have you tried googling 'area plot in R'?

There's a geom_area feature in ggplot2 which probably meets most expectations of 'high quality'. See examples and help at http://ggplot2.org/ (follow the documentation link)

stackpoly in plotrix draws stacked area charts in base graphics, though you'll have to add legend manually.

There's also a very pretty example using a custom base graphics functon at  http://menugget.blogspot.co.uk/2013/12/data-mountains-and-streams-stacked-area.html

... and so on ...

Personally, I like ggplot2 for prettiness and simplicity once you have your head round the grammar, but it can be quite hard to get to that point and it is perhaps _too_ pretty for publication line drawings. So for single graphs I generally stick to base graphics.

S Ellison



*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list