title: Using Stat_Summary when the data isn't normal
body: <p>I'm trying to plot confidence intervals for data that isn't normal.  I was given advice in using stat_summary, but I can't find any details on how to list the fun.args so that I get the 95th percentiles plotted as a ribbon.  Just taking the Excel percentiles for 0.05 and 0.95 for year 2 of S4 I get 31.015 and 31.104, rather than what the plot shows.  I assume the issue is with fun.data= mean_cl_normal, but there is very little info on what the options are.</p>
  
  <p><a href="https://i.stack.imgur.com/Io61k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Io61k.png" alt="enter image description here"></a></p>
  
  <p>Here is the data I'm using:</p>
  
  <p>data:</p>
  
  <pre>
  +-----------+-----------+-----------+-----------+------+
  |    S4     |    S5     |    S6     |    S7     | year |
  +-----------+-----------+-----------+-----------+------+
  | 31.052168 | 30.612594 | 30.328008 | 30.162733 |    2 |
  |   31.0111 | 30.664017 | 30.277935 | 30.118793 |    2 |
  | 31.049706 |  30.70231 | 30.341677 | 30.202466 |    2 |
  | 31.077554 | 30.701983 | 30.355643 | 30.161663 |    2 |
  | 31.056968 | 30.696955 | 30.323812 | 30.186214 |    2 |
  | 31.096337 | 30.679318 | 30.261566 | 30.080544 |    2 |
  | 31.073879 | 30.618196 | 30.281664 | 30.187808 |    2 |
  | 31.115269 | 30.700809 | 30.301731 | 30.211642 |    2 |
  | 31.085665 | 30.716211 | 30.362345 |  30.16574 |    2 |
  | 31.076053 | 30.720127 | 30.319381 |  30.14898 |    2 |
  | 31.017615 |  30.73175 | 30.326711 | 30.142657 |    2 |
  | 31.020176 | 30.660135 | 30.274531 | 30.144741 |    2 |
  |  31.04606 | 30.635148 | 30.362041 | 30.061961 |    2 |
  |  31.06509 |  30.65724 | 30.305546 | 30.062432 |    3 |
  | 30.974952 | 30.690091 | 30.305273 | 30.186476 |    3 |
  |  30.99952 | 30.658606 |  30.29415 | 30.203725 |    3 |
  | 31.013494 | 30.621646 |   30.2701 | 30.169807 |    3 |
  | 31.081632 | 30.702792 | 30.326554 | 30.063521 |    3 |
  | 31.033945 | 30.650637 | 30.334073 | 30.158865 |    3 |
  | 31.075722 | 30.627908 | 30.331883 | 30.125196 |    3 |
  | 31.036684 | 30.694549 | 30.322353 | 30.125278 |    3 |
  | 31.054786 |  30.60339 | 30.356116 | 30.125177 |    3 |
  | 31.089391 | 30.652875 | 30.268113 | 30.173289 |    3 |
  | 31.063207 |  30.65264 | 30.346941 | 30.174659 |    3 |
  | 31.050838 |   30.7144 |  30.28113 | 30.104956 |    3 |
  | 31.002156 | 30.727084 |  30.28905 |  30.15026 |    3 |
  | 31.052874 | 30.672237 | 30.325414 |    30.055 |    3 |
  | 31.116682 | 30.737313 | 30.309537 |  30.13867 |    3 |
  | 31.051456 | 30.662466 | 30.264082 | 30.125838 |    3 |
  | 31.082019 | 30.646523 | 30.300457 | 30.119709 |    3 |
  +-----------+-----------+-----------+-----------+------+
  </pre>
  
  <p>and the code: 
  Code:</p>
  
  <pre><code>library(tidyverse)
  dat &lt;- read.table("C:/temp.txt",sep="\t", header=TRUE)
  df &lt;- dat %&gt;%
    pivot_longer(cols = c(S4), names_to = "variable", values_to = "value")
  
  ggplot(df, aes(x = year, y = value, color = variable)) +
    stat_summary(geom = "line", fun = mean, linetype = "solid") +
    stat_summary(geom = "ribbon", fun.data= mean_cl_normal, fun.args = list(conf.int=0.95), alpha=.1)
  </code></pre>