title: adding a shaded standard deviation to line plots on ggplot2 for multiple variables
body: <p>I have one data frame with means of multiple ensembles from 5 different models, so 5 columns plus a date column, and a second data frame where i have the standard deviations.
  I would like to plot all in one plot, where i have the mean and a shaded standard deviation on each mean for the different models. Any idea how i can do this in ggplot?</p>
  <p>A sample data:</p>
  <p>Means:</p>
  <pre><code>Means &lt;- structure(list(M1 = c(0.146803, 0.1477525, 0.1465378, 0.1430386, 
  0.14315, 0.1407827, 0.1394645, 0.1389529, 0.1400275, 0.1375498
  ), M2 = c(0.09307112, 0.09162262, 0.09091183, 0.09075522, 0.09127082, 
  0.08992585, 0.08821484, 0.08810128, 0.08770718, 0.08705453), 
      M3 = c(0.1310087, 0.1255959, 0.1271953, 0.1270623, 0.1242448, 
      0.1249174, 0.1247585, 0.1224901, 0.1228224, 0.1207565), M4 = c(0.1328935, 
      0.133063, 0.1302629, 0.1291629, 0.1255703, 0.1244377, 0.1235587, 
      0.1236105, 0.1206313, 0.1192216), M5 = c(0.1312402, 0.1296496, 
      0.1288667, 0.1304318, 0.1291016, 0.1290919, 0.1286337, 0.1284389, 
      0.1270611, 0.1289673), date = c(&quot;2015-01-01&quot;, &quot;2016-01-01&quot;, 
      &quot;2017-01-01&quot;, &quot;2018-01-01&quot;, &quot;2019-01-01&quot;, &quot;2020-01-01&quot;, &quot;2021-01-01&quot;, 
      &quot;2022-01-01&quot;, &quot;2023-01-01&quot;, &quot;2024-01-01&quot;)), row.names = c(NA, 
  -10L), class = &quot;data.frame&quot;)
  </code></pre>
  <p>SD:</p>
  <pre><code>SD &lt;- structure(list(M1 = c(NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 
  NaN, NaN), M2 = c(0.002352747, 0.002636449, 0.002584647, 0.002942681, 
  0.003041309, 0.00279849, 0.00282362, 0.002546572, 0.002362555, 
  0.003004829), M3 = c(0.003872364, 0.003809441, 0.003494403, 0.004341524, 
  0.00372956, 0.00382587, 0.00394011, 0.00428747, 0.0030507, 0.003493746
  ), M4 = c(0.002779382, 0.003130044, 0.003052774, 0.002544359, 
  0.0028259, 0.002732643, 0.001902435, 0.001727357, 0.002808552, 
  0.001431315), M5 = c(0.003038877, 0.004208446, 0.005034087, 0.003276497, 
  0.004041488, 0.004525613, 0.003653864, 0.00377299, 0.003307351, 
  0.00320737), date = c(&quot;2015-01-01&quot;, &quot;2016-01-01&quot;, &quot;2017-01-01&quot;, 
  &quot;2018-01-01&quot;, &quot;2019-01-01&quot;, &quot;2020-01-01&quot;, &quot;2021-01-01&quot;, &quot;2022-01-01&quot;, 
  &quot;2023-01-01&quot;, &quot;2024-01-01&quot;)), row.names = c(NA, -10L), class = &quot;data.frame&quot;)
      
  
  
  df2 &lt;- melt(Means, id = &quot;date&quot;)
    tit &lt;- sprintf(&quot;%s %s Anuual Burden - %s&quot;, regnm, spcname, scenm)
    filename &lt;- sprintf(&quot;%s/TS_%s_%s_BurdenANN_%s.png&quot;,folderout, regnm, spcname, scenm)
    png(filename,width = 8 * 360, height = 5 * 360, res = 360)
    print(ggplot(data = df2, aes(x = date, y = value, color = variable)) + 
            geom_line(data=subset(df2, variable==&quot;M1&quot;), size=2) + 
            geom_line(data=subset(df2, variable==&quot;M2&quot;), size=2) + 
            geom_line(data=subset(df2, variable==&quot;M3&quot;), size=2) + 
            geom_line(data=subset(df2, variable==&quot;M4&quot;), size=2) + 
            geom_line(data=subset(df2, variable==&quot;M5&quot;), size=2) +               
            scale_colour_manual(name = spcname, breaks = c(&quot;M1&quot;,&quot;M2&quot;,&quot;M3&quot;,&quot;M4&quot;,&quot;M5&quot;), values = clr2) +
            xlab(&quot;Years&quot;) + ylab(sprintf(&quot;%s (Tg)&quot;, spcname)) + ggtitle(tit) + theme_bw() +  theme(legend.key = element_blank()) + 
            guides(color = guide_legend(override.aes = list(linetype = c(1,1,1,1,1), shape = c(NA,NA,NA,NA,NA)))) + theme(plot.margin=unit(c(1,3,1,1),&quot;cm&quot;))+
            theme(legend.position=c(1.1,.6), legend.direction = &quot;vertical&quot;) +
            theme(legend.title = element_blank())) # + expand_limits(y=0)
    dev.off()
  </code></pre>