# (TIL) Matplotlib: Plot error as shaded region

```
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 30, 30)
y = np.sin(x/6*np.pi)
error = np.random.normal(0.1, 0.02, size=y.shape)
y += np.random.normal(0, 0.1, size=y.shape)
plt.plot(x, y, 'k', color='#CC4F1B')
plt.fill_between(
x, y-error, y+error,
alpha=0.5, edgecolor='#CC4F1B', facecolor='#FF9848',
linewidth=4, linestyle='dashdot', antialiased=True,
)
plt.show()
```

Via StackOverflow.

## Comments