R: ggplot2 pointrange example : <p>I am currently reading <strong>R for Data Science</strong> by Hadley Wickham. In that, there is the following example:</p>

<pre><code>library(tidyverse)

ggplot(data = diamonds) + 
stat_summary(
    mapping = aes(x = cut, y = depth),
    fun.ymin = min,
    fun.ymax = max,
    fun.y = median
)
</code></pre>

<p>Now, there is a question as how to create the same plot by using appropriate <code>geom_</code> function. I looked at the default <code>geom</code> for <code>stat_summary</code> and it is <code>pointrange</code>.</p>

<p>So I tried the following:</p>

<pre><code>ggplot(data = diamonds) + geom_pointrange(mapping = aes(x = cut, y = depth), stat = "summary")
</code></pre>

<p>But I do not get the <code>min</code> and <code>max</code> points on the plot. </p>

<p><strong>How do I get the exact plot by using <code>geom_pointrange</code>?</strong></p>
