【发布时间】:2019-12-12 02:59:58
【问题描述】:
我有一个数据框:
test <- structure(list(Sample_ID = c("S1","S2", "S3", "S4", "S1", "S2", "S3", "S4"),
CN_Region = c("A", "A", "A", "A", "B", "B", "B", "B"),
MedianLog2Ratio = c(-0.2, -0.2, -0.25, -0.25, -0.25, -0.2, -0.1, -0.3),
CN_truth = c("2", "2", "2", NA, "2", "2", "2", "1")), class = c("data.table","data.frame"))
当我绘制hist 时,它工作正常:
hist(test$MedianLog2Ratio)
我想使用 ggplot 绘制每个区域的直方图,并使用与 SampleID 关联的 geom_points CN_truth 叠加:
g <- ggplot(test, aes(x = MedianLog2Ratio)) + geom_histogram()
g + geom_point(aes(colour = factor(CN_truth))
情节应该看起来像这样松散的(当然它会有更少的数据块和更少的数据):
其中图例指的是CN_truth,标题是CN_Region
【问题讨论】:
-
你的
geom_point的y是什么? -
Y = 0,只想以 0/1 频率绘制它