# raw data
n <- 5
d <- data.frame(id=1:n, m0=sample(n), m1=sample(n), m2=sample(n))
# reshape by melt
d2 <- melt(d, id="id")
# reorder the factor
d2$variable <- factor(d2$variable, levels=c("m2","m0","m1"))
# plot
ggplot(d2, aes(id, value, fill=variable)) + geom_area()
--
Kohske Takahashi <takahash...@gmail.com>
Research Center for Advanced Science and Technology,
The University of Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
Thanks for this. After importing the data as "allprofile", I used:
d2 <- melt(allprofile, id="id")
d2$variable <- factor(d2$variable, levels=c("my2","my0","my3"))
ggplot(d2, aes(id, value, fill=variable)) + geom_area()
However, it looks as if the legibility of the plot breaks down after about 50
observations, so 932 is probably too many. Converting the figures to
percentages is better in some ways.
In both cases, is the plot in order of the id? Some parts seemed as if they
were not in id sequence.
Thanks.
Kevin
::::On Friday 10 December 2010 Kohske Takahashi said::::
--
Pob hwyl / Best wishes
Kevin Donnelly
kevindonnelly.org.uk