This is an archival dump of old wiki content --- see scipy.org for current material.
Please see http://scipy-cookbook.readthedocs.org/

Use the fill function to make shaded regions of any color tint. Here is an example.

   1 from pylab import *
   2 
   3 x = arange(10)
   4 y = x
   5 
   6 # Plot junk and then a filled region
   7 plot(x, y)
   8 
   9 # Make a blue box that is somewhat see-through
  10 # and has a red border. 
  11 # WARNING: alpha doesn't work in postscript output.... 
  12 fill([3,4,4,3], [2,2,4,4], 'b', alpha=0.2, edgecolor='r')

shaded.png

SciPy: Cookbook/Matplotlib/ShadedRegions (last edited 2015-10-24 17:48:23 by anonymous)