ggplot2:堆积柱形图

输入文件格式如下:


library(ggplot2)
setwd("C:/Users/lenovo/Desktop")
data <- read.csv(file="111.csv",header = T)

ggplot(data=data, aes(x=Species, y=Value, fill=Type)) + 
+     geom_bar(stat="identity") +
+     facet_grid(~Soft) + 
+     labs(title="Prediction of Disease-related Mutations.", x="", y="Percentage of deleterious mutations", fill="Type") + 
+     theme(plot.title = element_text(size=25, margin=margin(t=20, b=30)))

参考链接:
http://theduke.at/blog/science/beginners-guide-to-creating-grouped-and-stacked-bar-charts-in-r-with-ggplot2/
https://stackoverflow.com/questions/21409850/generate-paired-stacked-bar-charts-in-ggplot-using-position-dodge-only-on-some

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容