This appears to work great. 
 
However, is there a way to programmatically to extract the bin size that ggplot 
selected in order to be able to change this for multiple data sets? 
 
Similarly, is there a way to determine the number of count in each bin that 
ggplot establish?  I wanted to change the axis a bit based on the count size, 
but I needed to do it programmatically give the large number of samples. 
 
For the example below, it would be something like the following:
ggplot(diamonds, aes(x=price, fill=cut)) +
geom_bar(position=position_dodge(width=default_ggplotbinwidth*0.75), 
binwidth=default_ggplotbinwidth) + ylim(0, ggplotmaxcount*1.1)
I would like to have access to the calculated ggplotbin and ggplotmaxcount for 
the data set.   
Thank you again for your help. 


--- On Mon, 2/2/09, hadley wickham <h.wick...@gmail.com> wrote:

From: hadley wickham <h.wick...@gmail.com>
Subject: Re: [R] Specifying the gap between "dodge'd" bins groups?
To: jasonkrup...@yahoo.com
Cc: Date: Monday, February 2, 2009, 11:10 AM

Hi Jason,

On Mon, Feb 2, 2009 at 9:10 AM, Jason Rupert <jasonkrup...@yahoo.com>
wrote:
> I'm looking at ggplot-static\position_dodge.html
>
> For ggplot(diamonds, aes(x=price, fill=cut)) +
geom_bar(position="dodge") , is it possible to specify the spacing
between the dodge'd bin groupings?
>
> That is, I would like for there to be a small separation (horizontal
space) between the "Ideal" and the "Fair" bars on the plot. 
That way the reader can get a better idea of when each bin ends and the other
begins.
>
> I think this "horizontal spacing" naturally occurs for discrete
data, but for continuous data as is shown in the second figure, the bins all
seem to right beside each other.  It would be nice if a small space could be
added.

You can do something like this:

ggplot(diamonds, aes(x=price, fill=cut)) +
geom_bar(position=position_dodge(width=400), binwidth=500)

Hadley

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



      
        [[alternative HTML version deleted]]

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

Reply via email to