To follow up on a previous question (Matplotlib fill_between invert?), I would like to invert the fill_between for multiple regions. The solution proposed for the original question, inverting foreground and background, doesn't work for multiple regions. Some code is below. Any thoughts?
import numpy as np
import matplotlib.pyplot as plt
# Doesn't work: want to invert filled and empty regions
def f1(x): return 32.0 * x + 2.0
def f2(x): return -55.0 * x
def f3(x): return 15.0 * x + 2.0
def f4(x): return -28.0 * x
xRng=[-1, 1]
plt.plot(xRng, [f1(x) for x in xRng], 'b-', alpha=0.5)
plt.plot(xRng, [f2(x) for x in xRng], 'r-', alpha=0.5)
plt.plot(xRng, [f3(x) for x in xRng], 'b-', alpha=0.5)
plt.plot(xRng, [f4(x) for x in xRng], 'r-', alpha=0.5)
plt.fill_between(xRng, [f1(x) for x in xRng], [f2(x) for x in xRng], color='g', alpha=0.1) # Would like the fill inverted
plt.fill_between(xRng, [f3(x) for x in xRng], [f4(x) for x in xRng], color='g', alpha=0.3) # Would like the fill inverted
plt.title('Want to invert filled and empty regions'); plt.show()


