[R] Specifying the gap between "dodge'd" bins groups?
hadley wickham
h.wickham at gmail.com
Mon Feb 2 23:11:41 CET 2009
> 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?
Well the default is 30 bins - i.e. range(x) / 30 - in practice you'd
want to choose something a bit more informative!
> 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.
Just set binwidth yourself. And why do you want ggplotmaxcount? (it
would be round_any(max(df$x), binwidth, ceiling))
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list