Skip to content

Instantly share code, notes, and snippets.

@ugo-nama-kun
Last active September 2, 2021 09:37
Show Gist options
  • Save ugo-nama-kun/2e1a089a751991728241dd823fb5eaf4 to your computer and use it in GitHub Desktop.
Save ugo-nama-kun/2e1a089a751991728241dd823fb5eaf4 to your computer and use it in GitHub Desktop.
Simplest possible upper & lower bound plot using matplotlib
import matplotlib.pyplot as plt
import numpy as np
N = 100
x = np.linspace(0, 6*np.pi, N)
y = np.sin(x)
upper = y + 0.2
lower = y - 0.5
plt.plot(x, y, color = (1, 0, 0, 0.6))
plt.fill_between(x, upper, lower, color = (1, 0, 0, 0.2))
plt.xlabel(r'$\theta$', labelpad = 15)
plt.ylabel('y', labelpad = 15)
plt.show()
@ugo-nama-kun
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment