R – plot quantiles with ggplot2

ggplot2r

I am new to ggplot and I have some questions. I hope someone can help me out in making the plot I want to make.

How can I plot quantiles that were previously calculated, with ggplot2?

X=runif(34,min=4, max=89)

quantiles.X=quantile(X,probs=c(.01,.03,.05,.1,.15,.20,.50,.70,.80,.90,.95))
> quantiles.X
      1%        3%        5%       10%       15%       20%       50%       70%       80%       90%       95%

5.292614  5.813105  9.509620 20.036279 25.542286 28.704292 49.796086 68.832996 76.725968 77.947276 80.549077

edited

I was aiming for the display of the quantiles was a form of histogram style or line.
Maybe to plot a line for each quantile over the point data will be more communicative/useful.

Best Answer

You could something along these lines:

X=runif(34,min=4, max=89)
p = c(.01,.03,.05,.1,.15,.20,.50,.70,.80,.90,.95)
dat = data.frame(q = quantile(X, probs = p),
                 prob = p)

And then plot using ggplot2:

ggplot(aes(x = prob, y = q), data = dat) + geom_line()