[R] ggplot2 qplot and add

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Thu Aug 2 19:58:37 CEST 2007


I think you need something like.

qplot(appetitive.stimulus, graphLabels, data=related.differences,
size=variance, colour="Appetitive Stimulus", xlim=c(-20,20), main="Title
here", xlab="Differences", ylab="Header Concepts") +
geom_point(aes(colour = "Aversive Stimulus"))

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

 

> -----Oorspronkelijk bericht-----
> Van: r-help-bounces op stat.math.ethz.ch 
> [mailto:r-help-bounces op stat.math.ethz.ch] Namens Emilio Gagliardi
> Verzonden: donderdag 2 augustus 2007 19:11
> Aan: r-help op stat.math.ethz.ch
> Onderwerp: [R] ggplot2 qplot and add
> 
> Hi there,
> 
> I have some simple frequencies I want to plot into one graph. 
>  I had it working, and now I can't figure out whats going 
> wrong.  All the data is stored in a dataframe, and i finally 
> managed to order the factor correctly!
> Each column is a variable and contains integers for the same 
> set of values in the column that contains the headers for 
> each row (graphLabels).
> 
> So, I get the data and my first call is:
> app <- qplot(appetitive.stimulus, graphLabels, 
> data=related.differences, size=variance, colour="Appetitive 
> Stimulus", xlim=c(-20,20), main="Title here", 
> xlab="Differences", ylab="Header Concepts")
> 
> which works great. Now, there are 16 columns in my dataframe 
> that I want to output together, so i tried the following:
> ave <- qplot(aversive.stimulus, graphLabels, 
> data=related.differences, size=variance, colour="Aversive 
> Stimulus", xlim=c(-20,20), main="Title here", 
> xlab="Differences", ylab="Header Concepts", add=app)
> 
> which according to what i can find (and actually got working 
> at some point) should add the data from the two columns to 
> the same graph.  However, that is not what is happening now.  
> The 'add' parameter does add the first plot object, but 
> instead of both sets of data appearing, only 'app' appears in 
> the output. If I remove the 'add' command, 'ave' outputs 
> correctly.  What am i doing wrong here? It feels like I'm 
> missing something ridiculously apparent.
> 
> Thanks for your help!
> emilio
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help op stat.math.ethz.ch 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.
>



More information about the R-help mailing list