是否可以在ggplot2中的密度图上添加渐变填充,以使图表中的颜色沿x轴变化?在下面的示例中,该fill参数似乎被忽略。
fill
library(ggplot2) ggplot(data.frame(x = rnorm(100)), aes(x = x, fill = x)) + geom_density()
r ggplot2
ggplot2 ×1
r ×1