Re: [R] fill histogram in ggplot

2017-11-07 Thread Ulrik Stervbo
Hi Elahe, You pass 'probable' to the fill aesthetic along the lines of; ggplot(hist) + aes(x=mms, fill = probable) + geom_histogram(binwidth=1) The NAs might give you three and not two colours. I'm guessing you want distinct colours. In this case 'probable' should be a factor and not an integ

[R] fill histogram in ggplot

2017-11-07 Thread Elahe chalabi via R-help
Hi all, I have the following data and I have a histogram for mms like ggplot(hist,aes(x=hist$mms))+ geom_histogram(binwidth=1,fill="white",color="black")and then I want to fill the color of histogram by probable=1 and probable=0, could anyone help me in this? My data: structure(list(pr