[R] ggplot2: how to combine position=stack and position=dodge in a single graph?

hadley wickham h.wickham at gmail.com
Sun Oct 5 03:37:49 CEST 2008

Hi Elena,

Currently, there's no way to combine stacking and dodging in a single
graphic.  However, you can often use faceting to get a similar effect
to dodging.  Could you explain your problem in a little more detail?



On Sat, Oct 4, 2008 at 4:22 PM, Elena Schulz <elena.schulz at gmx.net> wrote:
> Hi ggplot experts,
> I need to plot two time series of stacked data: a barchart with bars for
> each month. To compare the data of two years I need to combine both time
> series with in a single graph via position=doge.
> How should I do that?
> I tried the following scenario:
> I added two layers with the time series of the stacked data for both years.
> That worked well exept the bars are obscuring each other. How can  I shift
> one of the layers to get them displayed next to each other.
> Is there an other easier way to achieve this?
> Thanks a lot for any help on this.
> -- Elena
> ______________________________________________
> 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.


More information about the R-help mailing list