0
 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))

Bin 2 has two different colors, which I do not want. I've tried adjusting bin width, but it seems like a crapshoot. Is there any way to get consistency using (fill=cut)?.

2 colors in bin 2

Blake Shurtz
  • 321
  • 3
  • 13
  • Could you supply `mydata`? – Anonymous coward Aug 14 '18 at 22:25
  • 1
    Please share sample of your data using `dput()` (not `str` or `head` or picture/screenshot) so others can help. See more here https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example?rq=1 – Tung Aug 15 '18 at 01:24

0 Answers0