这是一个简单的问题,我无法以某种方式得到理想的结果。我想建造一个火山地块,我能够做到。这是代码:
CSCJFCTable <- read.table("volcano_plot_valuesCSCJ.csv", header = TRUE, sep = ",")
with(CSCJFCTable, plot(log2.FC., -log10(raw.pval), pch=20, main=""))
abline(h = 1.0, col = "blue
", lty = 2, lwd = 1)
abline(v = c(-1,1), col = "blue
", lty = 2, lwd = 1)
with(subset(CSCJFCTable, X.log10.p.<1.0), points(log2.FC., -log10(raw.pval), pch=20, col="gray"))
with(subset(CSCJFCTable, abs(log2.FC.)>1), points(log2.FC., -log10(raw.pval), pch=20, col="orange"))
我想将第一个框和第三个框中的点颜色更改为两种不同的颜色。所以,基本上,log2.FC. < -1 & -log10(raw.pval) > 1.0
颜色应为红色,log2.FC. > 1 & -log10(raw.pval) > 1.0
颜色应为绿色。并且,-log10(raw.pval)= 1.0以下的所有点都应该是灰色的。我怎样才能做到这一点?我厌倦了不同的组合,但它没有用。
答案 0 :(得分:0)
我终于得到了理想的解决方案:
CSCJFCTable <- read.table("volcano_plot_valuesCSCJ.csv", header = TRUE, sep = ",")
with(CSCJFCTable, plot(log2.FC., -log10(raw.pval), pch=20, main=""))
abline(h = 1.0, col = "blue
", lty = 2, lwd = 1)
abline(v = c(-1,1), col = "blue
", lty = 2, lwd = 1)
with(subset(CSCJFCTable, X.log10.p.<1.0), points(log2.FC., -log10(raw.pval), pch=20, col="gray"))
with(subset(CSCJFCTable, log2.FC.< -1 & X.log10.p.>1.0), points(log2.FC., -log10(raw.pval), pch=20, col="red"))
with(subset(CSCJFCTable, log2.FC.> 1 & X.log10.p.>1.0), points(log2.FC., -log10(raw.pval), pch=20, col="green"))