I'm looking for a way to fill in the area under a density plot, but only for part of the distribution. For example, consider the following distribution:
library("ggplot2")
set.seed(1234)
k <- rnorm(5000, mean=.1, sd=.08)
l <- data.frame(k)
avgk = mean(k)
ggplot(l, aes(x=k)) + geom_density(alpha = .5) + geom_vline(x=avgk) + geom_vline(x=0)
This creates a density curve with lines at 0 and the average. However, let's say I want to highlight the outcomes that are less than 0. (In this case, these are ROI percentages, and we want to look at the probability that it will be a money loser).
I would like to fill in the area under the curve that is 0 or less with a color.