[R] ggplot2 boxplot confusion

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Fri Feb 29 09:36:20 CET 2008


Chris,

I've learned those things by using R and trying to solve the problems I
encounter. The dummy is nothing more than a more elegant way of using
factor(1). The only connection with ggplot2, is that the plots will use
the name in the dataframe or the expression. And 'dummy' looks nicer
than 'factor(1)'.
I've found the position = "identity" solution by looking at the error
message which pointed to position = "dodge". In this case using an
alternative for the position argument solved the problem.

I'm using the same resource as you do: mainly my onw experience, the
online manual and the book. In case I get really stuck I use the mailing
list. I haven't used gplot.

Getting to know ggplot2 takes some time when you want to do some fancy
stuff. But once you get the hang of it ggplot2 gives nice graphs without
a very complex code.

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 r-project.org [mailto:r-help-bounces op r-project.org]
Namens Chris Friedl
Verzonden: donderdag 28 februari 2008 13:51
Aan: r-help op r-project.org
Onderwerp: Re: [R] ggplot2 boxplot confusion


Hey thanks Thierry! I learned two things here ... position="identity"
AND
x=dummy.

Can I ask where you learned these things. I've read a lot of the online
reference manual, "the book", other presentations of ggplot2 and don't
recall seeing these, especially the x=dummy reference.

Does this come from experience with the previous gplot package? Perhaps
I
should use that too?



ONKELINX, Thierry wrote:
> 
> Chris,
> 
> You need to specify position = "identity"
> 
> library(ggplot2)
> series <- c('C2','C4','C8','C10','C15','C20')
> series <- factor(series, levels = series)
> ids <- c('ID1','ID2','ID3')
> mydata <-
> data.frame(SERIES=rep(series,30),ID=rep(ids,60),VALUE=rnorm(180),
dummy
> = factor(1))
> ggplot(mydata, aes(y = VALUE, x = dummy)) + geom_boxplot(position =
> "identity") + facet_grid(SERIES ~ ID)
> 
> Thierry 
> 
> 

-- 
View this message in context:
http://www.nabble.com/ggplot2-boxplot-confusion-tp15706116p15735720.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help op 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.



More information about the R-help mailing list