ggplot2: Boxplot with given box size

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

ggplot2: Boxplot with given box size

Malcolm Ross Kinsella Ryan
Is there anyway in ggplot2 to set the aesthetics for a geom_boxplot  
directly, rather than having them computed by an implicit stat_boxplot?

If I try:

ggplot(data = t, aes(x = factor(x))) + geom_boxplot(coef=NULL,  
aes(lower=y_q1, upper=y_q3, middle=y_med, ymin=y_min, ymax=y_max))

I get the error:

Error: stat_boxplot requires the following missing aesthetics: y

Malcolm

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: ggplot2: Boxplot with given box size

hadley wickham
Hi Malcolm,

You need to tell geom_boxplot not to use stat_boxplot:
geom_boxplot(aes(lower=y_q1, upper=y_q3, middle=y_med, ymin=y_min,
ymax=y_max), stat = "identity")

Hadley

On Mon, Jul 6, 2009 at 6:55 AM, Malcolm Ryan<[hidden email]> wrote:

> Is there anyway in ggplot2 to set the aesthetics for a geom_boxplot
> directly, rather than having them computed by an implicit stat_boxplot?
>
> If I try:
>
> ggplot(data = t, aes(x = factor(x))) + geom_boxplot(coef=NULL,
> aes(lower=y_q1, upper=y_q3, middle=y_med, ymin=y_min, ymax=y_max))
>
> I get the error:
>
> Error: stat_boxplot requires the following missing aesthetics: y
>
> Malcolm
>
> ______________________________________________
> [hidden email] 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.
>



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

______________________________________________
[hidden email] 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.