Re: [R] ggplot2 boxplot confusion

From: Chris Friedl <cfriedalek_at_gmail.com>
Date: Wed, 27 Feb 2008 15:09:41 -0800 (PST)

Hi Hadley

First off, thanks for ggplot2 and everything that bringing it to life and sustaining it entails.

I noticed the coord flip problem during my ggplot investigations. Is this something I can override by getting into the code?

On the coord flipping problem I was thinking to grab the density data explicitly, swap x and y and then plot as a scatter plot with a box plot overlaid.

Or perhaps just draw the density plots with vertical lines drawn at the median, IQR etc

Or perhaps draw the density plots and fake a boxplot by drawing bars explicitly.

I'm hoping you can at least advise which of any of these routes is likely to be a dead end.

regards

Chris

hadley wrote:
>

>>  Now I think I understand want you want. I'm affraid that won't be easy
>>  because you're trying to mix continuous variables with categorical ones
>>  on the same scale. A density plot has two continuous scales: VALUE and
>>  it's density. The boxplot has a continuous scale (VALUE) and the other
>>  is categorical. Maybe Hadley knows a solution for your problem.

>
> Well one idea is:
>
> ggplot(diamonds, aes(x = price)) + geom_density(aes(min =
> -..density.., adjust= 0.5),fill="grey50", colour=NA) + facet_grid(. ~
> cut) + coord_flip()
>
> which looks like it would naturally fit with a boxplot overlaid on top
> of it. However, it's currently not possible because the boxplot is
> parameterised so that it is always horizontal, while the density is
> vertical - in the above example I have flipped the coordinate system,
> but that flips both density plot and boxplot.
>
> Hadly
>
> --
> http://had.co.nz/
>
>
-- 
View this message in context: http://www.nabble.com/ggplot2-boxplot-confusion-tp15706116p15725753.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Wed 27 Feb 2008 - 23:15:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Feb 2008 - 02:30:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive