In the first example, you can simply calculate the percentiles at each fixed location, and then build them using plt.fill_between .
something like that
# Last-modified: 16 Oct 2013 05:08:28 PM import numpy as np import matplotlib.pyplot as plt # generating fake data locations = np.arange(0, 50, 1) medians = locations/(1.0+(locations/5.0)**2) disps = 0.1+0.5*locations/(1.0+(locations/5.0)**2.) points = np.empty([50, 100]) for i in xrange(50) : points[i,:] = np.random.normal(loc=medians[i], scale=disps[i], size=100) # finding percentiles pcts = np.array([20, 35, 45, 55, 65, 80]) layers = np.empty([50, 6]) for i in xrange(50) : _sorted = np.sort(points[i,:]) layers[i, :] = _sorted[pcts] # plot the layers colors = ["blue", "green", "red", "green", "blue"] for i in xrange(5) : plt.fill_between(locations, layers[:, i], layers[:, i+1], color=colors[i]) plt.show()

nye17 source share