> 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/ ______________________________________________ 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.