I am trying to build a translucent rectangle of the same color as the background above the density curve, so it creates a lighter vertical area of ββthe latter (hacking to visualize a range of interests such as rush hours). As you can see, alpha fails. I wonder if anyone can get the following code?
I know that there are other reports of ggplot alpha channel problems ( for example ), but no one seems to be resolving this, and its not clear what the current situation is version-wise.
Thank you in advance:)

d <- data.frame(rnorm(100, mean = 0, sd = 100)); names(d) <- 'data' ggplot(d) + geom_density(aes(x=data),col=NA, fill='grey30') + opts(panel.background=NULL) + geom_rect(aes(xmin=-30, xmax=30, ymin=0, ymax=0.005), fill='white',alpha=0.2) ggplot(d) + geom_density(aes(x=data),col=NA, fill='grey30') + opts(panel.background=NULL) + geom_rect(aes(xmin=-30, xmax=30, ymin=0, ymax=0.005), fill='#FFFFFF40')
source share