Hi:

Your example doesn't make much sense as stated, but is this what you had in
mind?

d <- ggplot (mtcars, aes(qsec, wt)
d + geom_point() + stat_smooth(aes(colour = factor(cyl)),
   fill="darkgrey", size=2, alpha = 0.2) +
   scale_colour_discrete("No. cylinders")

In this case, the multiple plots were obtained by grouping on different
numbers of cylinders, which was coerced to a factor in order to use it as a
grouping variable. There are many ways to apply this 'grouping' trick in
ggplot2 using the companion plyr package, several of which can be found in
the ggplot2 list archives http://had.co.nz/ggplot2/ (look for Mailing List)
and in Hadley's book:
http://tinyurl.com/ggplot2-book.

HTH,
Dennis

On Fri, Aug 13, 2010 at 11:36 PM, newbie_2010 <girishb...@gmail.com> wrote:

>
> is it possible to map 2 plots(c and d) in a single output plot?
>
> library(ggplot2)
> c <- ggplot(mtcars, aes(qsec, wt))
> d <- ggplot (mtcars, aes(qsec, wt))
> c + stat_smooth(fill="darkgrey", colour="blue", size=2, alpha = 0.2)
> d + stat_smooth(fill="darkgrey", colour="red", size=2, alpha = 0.2)
> --
> View this message in context:
> http://r.789695.n4.nabble.com/is-it-possible-to-map-2-plots-c-and-d-in-a-single-output-plot-tp2325023p2325023.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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