i using ggplot
function plot kind of graph image
i want add specific value of x-axis shown in picture
this code :
quantiles <- quantile(mat,prob = quant) x <- as.vector(mat) d <- as.data.frame(x=x) p <- ggplot(data = d,aes(x=x)) + theme_bw() + geom_histogram(aes(y = ..density..), binwidth=0.001,color="black",fill="white") + geom_density(aes(x=x, y = ..density..),fill="blue", alpha=0.5, color = 'black') x.dens <- density(x) df.dens <- data.frame(x = x.dens$x, y = x.dens$y) p <- p + geom_area(data = subset(df.dens, x <= quantiles), aes(x=x,y=y), fill = 'green', alpha=0.6) print(p)
Comments
Post a Comment