.. _sphx_glr_gallery_pyplots_whats_new_98_4_fill_between.py: ============================= Whats New 0.98.4 Fill Between ============================= .. image:: /gallery/pyplots/images/sphx_glr_whats_new_98_4_fill_between_001.png :align: center .. code-block:: python import matplotlib.mlab as mlab import matplotlib.pyplot as plt 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, ax = plt.subplots() 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') plt.show() .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: binder-badge .. image:: https://static.mybinder.org/badge.svg :target: https://mybinder.org/v2/gh/choldgraf/matplotlib/gh-pages?filepath=_downloads/whats_new_98_4_fill_between.ipynb :width: 150 px .. container:: sphx-glr-download :download:`Download Python source code: whats_new_98_4_fill_between.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: whats_new_98_4_fill_between.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_