Logo Search packages:      
Sourcecode: matplotlib version File versions  Download package

whats_new_98_4_fill_between.py

#!/usr/bin/env python
import matplotlib.mlab as mlab
from pylab import figure, show
import numpy as np

x = np.arange(0.0, 2, 0.01)
y1 = np.sin(2*np.pi*x)
y2 = 1.2*np.sin(4*np.pi*x)

fig = figure()
ax = fig.add_subplot(111)
ax.plot(x, y1, x, y2, color='black')
ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green')
ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
ax.set_title('fill between where')

show()

Generated by  Doxygen 1.6.0   Back to index