ggplot2:堆积柱形图
2020-01-13 本文已影响0人
Mr_我爱读文献
输入文件格式如下:
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