On Tuesday 13 April 2010 16:37:21 hettling wrote:
> 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:
[...snip...]
> 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

Hi Hannes,

maybe hatching of the regions help to distinguish the 3 different regions of 4 
regions (see the code below).

Kind regards,
Matthias

=======
from matplotlib import pyplot as plt
import numpy as np

##Data to plot
seq = np.sin(range(0, 10))
xpts = np.concatenate((range(0, 10), range(0, 10)[::-1]))

plt.figure()
##Plot 3 overlapping regions, a different color for each one
for diff, color, hatch in zip([1, 2, 3], ["blue", "red", "yellow"],
                              ['/', '|', '\\']):
    ypts = np.concatenate((seq - diff, (seq - diff * 2)[::-1]))
    plt.fill(xpts, ypts, alpha=0.7, fc=color, hatch=hatch, ec="black",
             lw=2, label=str(diff))

plt.legend()
plt.show()
=======

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to