|
I frequently use kernel density plots to illustrate distributions. These are easy and fast to create in R like so:
Which gives me this nice little PDF:
I’d like to shade the area under the PDF from the 75th to 95th percentiles. It’s easy to calculate the points using the
But how do I shade the the area between |
|
|
With the You need to find the index of the quantile values to get the actual Edit: Here you go:
Output (added by JDL)
|
|
|
Another solution:
Result: |
|
|
This question needs a
|




An expanded solution:
If you wanted to shade both tails (copy & paste of Dirk’s code) and use known x values:
Result: