Search code examples
rggplot2stacked-area-chart

ggplot2 stacked area-bar plot in R


Is there a way to combine stacked bar plot and stacked area plot in ggplot2 (or in any other graphics package in R)? I'd like to create a stacked bar plot with some space between the columns. The groups of the bars should than be connected by the areas. In other words, instead of edges of an area plot, there should be bars with percentage labels for the groups.

What I've tried is:

ggplot(subdata, aes(x=variable, y=value, group=Name, fill=Name)) +
geom_area (positon="fill") +
geom_bar(stat="identity", colour="black")

The problem is that I'd like the filled areas to connect the boundaries of the bars rather than their midlines. Is there a way to accomplish this?


Solution

  • I asked this question on the ggplot2 mailing list after not getting any answers here, and Winston Chang came up with a solution: Thread within ggplot2 google group