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. Thank you agian for your help and feedback. [[alternative HTML version deleted]]
hadley wickham
2009-Feb-02 17:10 UTC
[R] Specifying the gap between "dodge'd" bins groups?
Hi Jason, On Mon, Feb 2, 2009 at 9:10 AM, Jason Rupert <jasonkrupert at 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/