简体   繁体   中英

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?

在这里没有任何答案后,我在ggplot2邮件列表上问了这个问题,Winston Chang提出了一个解决方案: ggplot2 google group中的线程

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM