[R] plotEst

hadley wickham h.wickham at gmail.com
Sat Feb 23 18:51:39 CET 2008


On Tue, Feb 19, 2008 at 3:53 PM, sigalit mangut-leiba <smangut at gmail.com> wrote:
> Sorry to disturb,
>  I managed to plot 2 together with 'layer' like this:
>
>
>
>  qplot(se, or, min=lcl1, max=ucl1, data=df1, geom="pointrange")+layer(data =
>  df2, mapping = *aes*(x = se, y = OR2,min=lcl2,max=ucl2), geom =
>  "pointrange")+geom_line()

An easier way would be to do something like this:

df1$id <- 1
df2$id <- 2
df <- rbind(df1, df2)

qplot(se, or, min=lcl1, max=ucl1, colour=factor(id), data=df,
geom="pointrange") +
geom_line()

That way you get a nice legend too.

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



More information about the R-help mailing list