I have a histogram as shown in the picture. I want the bars in the two regions
Here's the method I mentioned in comments:
Make some test data (you should do this in your question!)
test = runif(10000,-2,0)
get R to compute the histogram but not plot it:
h = hist(test, breaks=100,plot=FALSE)
Your histogram is divided into three parts:
ccat = cut(h$breaks, c(-Inf, -0.6, -0.4, Inf))
plot with this palette, implicit conversion of factor to number indexes the palette:
plot(h, col=c("white","green","red")[ccat])
ggplot2
solutions are also available.