Dear all,
I want to plot 3 overlapping regions using fill() into one panel, but my
solution looks sort of messy... Here is the code:
···
===
import matplotlib.pyplot as plt
import scipy
##Data to plot
seq = scipy.sin(range(0,10))
xpts = scipy.concatenate((range(0,10), range(0,10)[::-1]))
plt.figure()
##Plot 3 overlapping regions, a different color for each one
for diff, color in zip([1,2,3], ["blue", "red", "yellow"]):
ypts = scipy.concatenate((seq - diff, (seq - diff * 2)[::-1]))
plt.fill(xpts, ypts, alpha=0.4, fc=color, ec="black", lw=2,
label=str(diff))
plt.legend()
plt.show()
The figure looks like 4 regions are plotted, because overlapping red and
yellow make an orange region... I tried some different combination, but
it never looked good. Does anybody have an idea how to chose the colors
and 'alpha' values for transparency so that the plot looks good and
could be printed?
Any help is appreciated,
thanks in advance,
Hannes