Can you combine pyplot.fill_between and pyplot.fill_betweenx?

Viewed 33

I have errors in x and y axis in my plot, but just want to show the "enveloping" error area. How is that possible?

So far I tried drawing the error areas seperately and giving them the same color, but that way I lose the benefit of using alpha for transparency when I have more than one curve. I'd rather keep a transparent "enveloping" error area for each curve.

I provided a minimal working example of my code:

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(0,10, 0.1)
y = x**2

x_err = np.sin(x)
y_err = 10*np.cos(x)

plt.plot(x,y,'k')
plt.fill_between(x, y-y_err, y+y_err, color = 'b', alpha=0.2)
plt.fill_betweenx(y, x-x_err, x+x_err, color = 'b', alpha=0.2)

Combining fill_between and fill_betweenx

0 Answers
Related