在ggplot中bin 2种不同的颜色

时间:2018-08-14 15:54:29

标签: r ggplot2

 set.seed(1234)
mydata$time.remaining <- rpois(31, 5)
ggplot(mydata, aes(x=time.remaining, fill = cut(time.remaining, 6))) +
  geom_histogram(binwidth=1.2, colour="black", show.legend = FALSE) +
  geom_vline(aes(xintercept=mean(time.remaining, na.rm=T)),   # Ignore NA values for mean
             color="red", linetype="dashed", size=1) +
  ggtitle("Number of Test-outs and Days Remaining") +
  scale_fill_discrete(h = c(400, 120))

容器2有两种我不想要的颜色。我已经尝试过调整纸槽宽度,但这似乎很糟糕。有什么办法可以使用(fill = cut)来获得一致性?。

2 colors in bin 2

0 个答案:

没有答案
相关问题