【发布时间】:2021-10-18 15:20:54
【问题描述】:
我想绘制 p 值 pv.scf。为什么我的直方图没有反映我的 4 个 p 值?
> dput(pv.scf)
c(`211124_s_at` = 0.0003175435117273, `207029_at` = 0.00882067488788698,
`216974_at` = 0.586375149259342, `226534_at` = 0.651991817084333
)
# Plot the sorted raw P-values
png("SCF_Raw_PvaluePlot.png")
par(mfrow=c(1,2))
hist(pv.scf, cex=0.9, col=c("#c1a87d", "#7ef9ff", "#97b9ce", "#1f456e"), las=2, cex.axis=0.6, xlab="Probes", ylab="P-values", main="Raw P-values for KITLG gene\n")
names(c("211124_s_at", "207029_at", "216974_at", "226534_at"))
abline(v=.01,col=2,lwd=2)
hist(-log10(pv.scf), col=c("#c1a87d", "#7ef9ff", "#97b9ce", "#1f456e"), xlab="Probes", ylab="log10(p-values)", main="-log10(P-values) for KITLG gene between\nall groups", cex.main=0.9)
names(c("211124_s_at", "207029_at", "216974_at", "226534_at"))
abline(v= -log10(.01),col=2,lwd=2)
dev.off()
【问题讨论】:
-
您确定要使用直方图吗?也许你真的想要
barplot?直方图将x值分组。碰巧你的两个值落入同一个箱子里。所以一个 bin 的计数为 2,另外两个 bin 的计数为 1。也许您可以更清楚地准确描述您希望此图的样子。
标签: r plot data-science histogram p-value