On Wed, Sep 17, 2008 at 1:01 PM, Josip Dasovic <[EMAIL PROTECTED]> wrote:
> Hi:
>
> I've searched the archives and the Internet for hours but have yet to find a 
> way to do stacked area plots (like the kind in Excel) in R.  I think that 
> polygon may work but it would require a bit of manipulation of my data. I was 
> hoping for an easier way.
>
> An example of what I'm trying to do can be found here:
> http://jcharts.sourceforge.net/samples/stackedArea.html

These are pretty easy in ggplot2:

df <- data.frame(
  trt = rep(letters[1:3], each = 10),
  year =  rep(1:10, 3),
  value = abs(rnorm(30))
)

install.packages("ggplot2")
library(ggplot2)
qplot(year, value, data=df, geom="area", fill = trt)

Hadley
-- 
http://had.co.nz/

______________________________________________
R-help@r-project.org 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 via email to