Last active
November 2, 2017 13:43
-
-
Save erikaris/76c23557cdf23313f2532d6a9e9b45a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib notebook | |
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, ax1) = plt.subplots(2, 1, sharex=True) | |
ax.plot(x, y1, x, y2, color='black') | |
ax.fill_between(x, y1, y2, where=y2 >= y1, facecolor='green', interpolate=True) | |
ax.fill_between(x, y1, y2, where=y2 <= y1, facecolor='red', interpolate=True) | |
ax.set_title('fill between where') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment