I was wondering if I could plot the reflection of my "Density Histogram" (i.e., shadow [as shown in "blue" in the below picture]) in (possibly) "Base" R?
Please see my R code below the picture.
Here is my R code:
set.seed(0) ; x = rnorm(n = 1e4) ; den = density(x)
plot( den$x , den$y , ty = 'n' , ylim = c( -max(den$y), max(den$y) ) , xlim = c(min(den$x), max(den$x)) )
b = hist(x, freq = F , ylim = c( -max(den$y), max(den$y) ), main = NA )
polygon( c(den$x, den$x) , c(den$y, -den$y) )