3
vlineをカットオフとして濃度プロットをシェードすることは可能ですか?たとえば:vlineの左側に陰影濃度プロット?
df.plot <- data.frame(density=rnorm(100))
library(ggplot2)
ggplot(df.plot, aes(density)) + geom_density() +
geom_vline(xintercept = -0.25)
私は、新しい変数を作成しようとしたが、私は私がggplot
と直接それを行う方法を知らない
df.plot <- df.plot %>% mutate(color=ifelse(density<(-0.25),"red","NULL"))
ggplot(df.plot, aes(density, fill = color, colour = color)) + geom_density() +
geom_vline(xintercept = -0.25)