我想使用颜色渐变,其中箱子从蓝色(最低)到黄色(最高)。这个
scale_fill_gradient()
函数似乎实现了这一点,但当我将其插入
rainbow()
对于
fill
参数i收到错误:
> ggplot(df) +
+ geom_histogram(aes(x), fill = scale_fill_gradient(low='blue', high='yellow'))
Error: Aesthetics must be either length 1 or the same as the data (30): fill