Re: scatterplot and bubblechart merge.

8 views
Skip to first unread message

Doug Mitarotonda

unread,
May 15, 2013, 10:07:25 AM5/15/13
to Minhie, ggp...@googlegroups.com
Before getting into the details of plotting two geoms on the same plot, it looks like you are trying to plot two different y-axes on the same plot (I am guessing this because they are named differently, even though they seem to be close in magnitude). If so, that is the first thing you will need to resolve as ggplot does not allow for that functionality. There are ways around this by doing things like scaling the y-axes to common values. There was a thread on this on this mailing list a few weeks ago with subject "second y-axis." There are also many other resources on this general topic so I encourage you to search around.

In terms of plotting two geoms on the same plot, it would be something like:
p <- ggplot(mapping = aes(x = Datum, y = Temparatuur) + geom_point(aes(size = Bacteria, color = Peilbuis), data = data) + geom_line(data = total)


On May 15, 2013, at 5:27 AM, Minhie <minh.n...@gmail.com> wrote:

Hello everybody,
I am new to this group and also new to R, so i hope this is sufficient information.
I have 2 graphs 
ggplot(data=data,aes(x=Datum,y=buistemp,size=Bacteria,color=Peilbuis))+geom_point()+scale_size_continuous(range=c(2,10))
and
qplot(data=total,x=Datum,y=Temperatuur)+geom_line()

Basically I want to merge these 2 plots into 1 plot (so I want to overlay the bottom graph on top of the first plot).
I have tried to make a new dataset of the all the variables, however i end up with a lot of NA's since there are a lot of datapoints on the temperature in the upper graph. 
Does anybody have a solution to this?

Thank you in advance.

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
 
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages