我有类似的数据:
2L A=>C 6.2
2L A=>G 13.6
2L A=>T 6.7
2L C=>A 5.3
2L C=>G 3.8
2L C=>T 12.6
2L G=>A 14.1
2L G=>C 4.3
2L G=>T 5.5
2L T=>A 10.3
2L T=>C 12.6
2L T=>G 5
2R A=>C 5.1
2R A=>G 11.2
2R A=>T 9.4
2R C=>A 4
2R C=>G 4
2R C=>T 11.6
2R G=>A 17
2R G=>C 4
2R G=>T 6.9
2R T=>A 9.1
2R T=>C 12
2R T=>G 5.8
而且我正在尝试为每个色度(data[,1]
)制作单独的条形图。我可以将其绘制在同一图上:
library(ggplot2)
snps<-read.table("new.txt", header = FALSE)
chroms<-snps[,1]
trans<-snps[,2]
freq<-snps[,3]
ggplot(snps, aes(x = trans, y = freq, group = chroms, fill = chroms)) + geom_bar(position="dodge",stat="identity")
但是,我希望能够分别绘制每个色度。当我尝试使用时facet_grid
,出现以下错误消息:
ggplot(snps, aes(x = trans, y = freq, group = chroms, fill = chroms)) +
geom_bar(position="dodge",stat="identity") + facet_grid(chroms ~ .)
---
Error in combine_vars(data, params$plot_env, rows, drop = params$drop) :
At least one layer must contain all variables used for facetting
在此示例中,如何正确使用刻面?
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句