在绘制ggplot时缺少值

时间:2018-03-31 14:23:14

标签: r

我尝试使用

进行绘图
ggplot2

但是我收到此错误:

Error in ggproto(NULL, super, call = match.call(), aesthetics = aesthetics,  : 
  argument "values" is missing, with no default

这里是绘图的数据

  IND1 <- c(3.422 -0.11708, -0.58419, NA, -2.40179, 0.26907, -2.30089, NA, NA)
   Dep <- c("D1","D2","D3","D4","D5","D6","D7","D8")
dd <- data.frame(Dep, IND1)   
library(ggplot2)
ggplot(dd, aes(x = Dep, y = IND1, fill = (IND1 > 0))) +
    geom_col() +
    scale_fill_manual(value = c("purple", "blue")) +
    coord_flip()
I think it has to do with NA I have. Is there anything I can?

1 个答案:

答案 0 :(得分:2)

你写了一个错字:

替换

scale_fill_manual(value = c("purple", "blue"))

scale_fill_manual(values = c("purple", "blue"))