ggplot2:堆积柱形图

输入文件格式如下:


ggplot2:堆积柱形图_第1张图片
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)))

ggplot2:堆积柱形图_第2张图片

参考链接:
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

你可能感兴趣的:(ggplot2:堆积柱形图)