Re: [R] Multiple density plots

From: hadley wickham <h.wickham_at_gmail.com>
Date: Mon, 10 Mar 2008 16:12:51 -0500

On Mon, Mar 10, 2008 at 3:55 PM, Sean MacEachern <sean.maceach_at_gmail.com> wrote:
> Hi all,
>
> I'm interested in doing a multiple density plot on a number of columns in a
> dataframe.
>
> >DF
>
> lineA.1 lineA.2 lineB.1 lineB.2
> r1 5.355354 6.665575 10.288498 11.74750
> r2 3.643415 5.427600 11.407112 13.97065
> r3 5.813674 6.438502 9.628871 11.57456
> r4 5.241340 5.125049 10.456221 12.35381
> r5 4.640885 8.635518 8.344704 11.98484
> r6 4.559852 6.416171 10.419599 10.89247
> r7 4.058033 7.378469 9.043280 11.88214
> r8 3.439271 5.108395 10.197870 10.65987
> r9 5.129664 4.326907 8.851552 11.46618
> r10 4.258742 7.002541 8.716967 13.07019
>
>
>
> I have been reading about the simple.densityplot
>
> However, I can't find it in R has it been replaced?
>
>
>
> >simple.densityplot(line6.1,line6.2,line7.1,line7.2, data = DF)
> Error: could not find function "simple.densityplot"

You could also try:

install.packages("ggplot2")
library(ggplot2)

qplot(value, data = melt(DF), colour=variable, geom="density")

which will give you a nice legend as well.

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

______________________________________________
R-help_at_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.
Received on Mon 10 Mar 2008 - 21:16:06 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 10 Mar 2008 - 22:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive