[R] Overlaying graphs from different datasets with ggplot

hadley wickham h.wickham at gmail.com
Mon May 4 01:23:49 CEST 2009


On Thu, Apr 30, 2009 at 2:03 PM, MUHC-Research
<villandl at dms.umontreal.ca> wrote:
>
> Dear R-users,
>
> I recently began using the ggplot2 package and I am still in the process of
> getting used to it.
>
> My goal would be to plot on the same grid a number of curves derived from
> two distinct datasets. The first dataset (called molten.data) looks like
> this :
>
> Column names : Perc, Week, Weight
>
> P10   21  333.3554
> P90   21  486.0480
> P10   22  452.6347
> P90   22  563.8263
> P10   23  575.0960
> P90   23  661.6841
> P10   24  700.4449
> P90   24  779.4067
> P10   25  828.4966
> P90   25  917.1222
>
> The second dataset (called skj) looks like this:
>
> Column names : Week, Perc, Weight
>
> 21    1  317.5
> 22    1  392.5
> 23    1  467.5
> 24    1  542.5
> 25    1  617.5
> 26    1  697.5
> 21    2  535.0
> 22    2  632.5
> 23    2  737.5
> 24    2  855.0
> 25    2  980.0
> 26    2 1115.0
> 21    3  425.0
> 22    3  512.5
> 23    3  602.5
> 24    3  697.5
> 25    3  800.0
> 26    3  907.5
>
...

> So, what am I doing wrong in this situation?

The perc columns are different in the two data frames.  How do you
expect them to match up?

Hadley

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




More information about the R-help mailing list