title: Plotting quantiles around mean histogram
body: <p>I have N samples, each of which has n values in it. For each sample, I plot the histogram of n values. In total, I would have N histogram. Now I would like to have a plot that shows the mean of these histograms and have the 5-95% quantile region shaded. An example of such a plot would look like (please don't mind the dashed line and black line, just the shaded area.)</p>
  
  <p><a href="https://i.stack.imgur.com/TVoY2m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TVoY2m.png" alt="enter image description here"></a></p>
  
  <p>So far, I have plotted all the N histograms on top of each other.</p>
  
  <p><a href="https://i.stack.imgur.com/XzCTWm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XzCTWm.png" alt="enter image description here"></a></p>
  
  <p>I realized that the mean of these histograms would be the histogram of all [N X n] values together. A sample code for this would look like</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  samples = []
  N = 20
  n = 250
  
  for i in range(N):
      samples.append(np.random.normal(loc=np.random.rand(1,)[0]/5-0.1, scale=1., size=n))
  
  values_all = None
  for i in range(len(samples)):
  
      values = samples[i]
      print(values)
  
      weights = np.ones_like(values) / float(len(values))
      plt.hist(values, range=[-4, 4], density=False, histtype='step', color='red', bins=15, weights=weights)
  
      if values_all is None:
          values_all = values
      else:
          values_all = np.concatenate(([values_all, values]), axis=0)
  
  weights = np.ones_like(values_all) / float(len(values_all))
  plt.hist(values_all, range=[-4, 4], density=False, histtype='step', color='black', bins=15, weights=weights)
  plt.show()
  </code></pre>
  
  <p>Any suggestions on how to find and plot the 5-95% quantiles would be appreciated.</p>