我希望根据散点图中的点是否符合我的Depo
标准来对其进行着色。我尝试用Cutoff
着色并为Depo
使用形状,但这并没有给我带来视觉效果。我真的希望只有在Cutoff
和所有Depo
都为黑色的地方,才用Cutoff = Good/Maybe
上色。
Cutoff = Bad
我尝试过此方法,但不会使不良样品脱颖而出
Depth Pj T Depo Cutoff
100.69 1.095802 0.9986513 Dri Good
97.04 1.009357 0.9624445 Pro Good
74.74 1.039274 0.9880176 Tur Maybe
106.46 1.054291 0.9873374 Pro Maybe
109.37 1.117034 0.9913281 Dri Bad
90.29 1.01166 0.9107071 Pro Bad
答案 0 :(得分:0)
这样的事情怎么办?
df %>%
mutate(col = factor(ifelse(
Cutoff %in% c("Good", "Maybe"),
as.character(Depo),
NA))) %>%
ggplot(aes(x = Pj, y = T, colour = col, shape = Cutoff)) +
geom_point()
df <- read.table(text = "Depth Pj T Depo Cutoff
100.69 1.095802 0.9986513 Dri Good
97.04 1.009357 0.9624445 Pro Good
74.74 1.039274 0.9880176 Tur Maybe
106.46 1.054291 0.9873374 Pro Maybe
109.37 1.117034 0.9913281 Dri Bad
90.29 1.01166 0.9107071 Pro Bad", header = T)