ggplot2 相关 2020-05-05

2020-05-05  本文已影响0人  SnorkelingFan凡潜

All ggplot2 plots begin with a call to ggplot(), supplying default data and aesthethic mappings, specified by aes().
You then add layers, scales, coords and facets with +.
To save a plot to disk, use ggsave()


示例

library(ggplot2)
table=read.table("kaks.result.table",sep="\t",header=T)
pdf(file="ka2.pdf")
ggplot(table,aes(x=gene,y=ka,fill=gene))+geom_boxplot()+labs(x="Genes",y="Ka")
dev.off()
pdf(file="ks2.pdf")
ggplot(table,aes(x=gene,y=ks,fill=gene))+geom_boxplot()+labs(x="Genes",y="Ks")
dev.off()
pdf(file="kaks2.pdf")
ggplot(table,aes(x=gene,y=kaks,fill=gene))+geom_boxplot()+ylim(0, 5)+labs(x="Genes",y="Ka/Ks")
dev.off()
上一篇 下一篇

猜你喜欢

热点阅读