ggplot() +
geom_point(data=as.data.frame(res), aes_string(x=res$log2FoldChange, y=-log10(res$padj)), colour="darkgrey", alpha=6/10, size=2) +
geom_point(data=sig_data, aes_string(x=sig_data$log2FoldChange, y=-log10(sig_data$padj)), shape = 21, colour=sig_data$baseMean, alpha=5/10, fill = NA, size=2,stroke=0.75)+
scale_color_brewer(palette="Blues")
无论我指定什么样的色标,都会使用愚蠢的彩虹刻度而没有任何图例表明颜色的含义。
答案 0 :(得分:2)
我的猜测是你的语法错了。它应该是
aes(x = log2FoldChange, y = -log10(padj), color = baseMean)
或者如果您对使用aes_string
aes_string(x = "log2FoldChange", y = "-log10(padj)", color = "baseMean"))
这是一个例子
library(ggplot2)
ggplot(mtcars, aes(x = mpg, y = -log10(wt), color = as.factor(cyl))) +
geom_point()
ggplot(mtcars, aes_string(x = "mpg", y = "-log10(wt)", color = "as.factor(cyl)")) +
geom_point()