The example (e) in my previous script have a code and a text label mismatched.
I'm attaching the corrected one.

I took a more look on how a patch is drawn.
the draw() method of a patch calls draw_path method of the renderer,
which seems to be responsible for both "fill", and "stroke". But there
is only one alpha value (gc.alpha). The rgbFace is a tuple of r,g,b
and does not have a alpha value.

        renderer.draw_path(gc, tpath, affine, rgbFace)

Thus, it seems that is is not possible to have different alpha for
"fill" and "stroke".
One of the easiest solution would be call the draw_path twice, each
for fill and stroke.


>
> I can't look at this specifically now, but I suspect it is a side effect of
> the way that alpha support has evolved, resulting in a confusing mess.  Some
> things are RGB, others are RGBA; alpha defaults get set in various places,
> and there is no clear way of keeping track of what is just a default and
> should be overridden, versus what has been set deliberately and should *not*
> be overridden. I dimly remember looking into it a few months ago, thinking
> that it could be cleaned up with some simple changes, but failing.  I really
> wish we could make some sweeps through the mpl code base and systematically
> clean up some of these messes.  I don't know how many there are, but
> certainly more than one. Dpi is another area of perennial confusion, for
> example.
>
> Eric
>
>

Thanks for the explanation.
I personally think that the default behavior for setting alpha is
better to be multiplying with the previous one, instead of overriding.
We may introduce override keyword in set_alpha method to to force the
override. I think it should be considered a bug If there are more than
one alpha defaults involved. Just a thought.
And, yes, dealing with the dpi is always confusing!

-JJ
import  matplotlib.pyplot as plt
#plot([1,2], alpha=0.1)
plt.clf()

plt.text(0.2, 0.6, "(a)\nec=1,0,0,0.1\nfc=none\nalpha=1",
         bbox=dict(ec=(1,0,0,0.1),
                   fc="none",
                   alpha=1.,
                   lw=5),)

plt.text(0.2, 0.4, "(b)\nec=1,0,0,1\nfc=none\nalpha=0.1",
         bbox=dict(ec=(1,0,0,1),
                   fc="none",
                   alpha=0.1,
                   lw=5),)


plt.text(0.2, 0.2, "(c)\nec=1,0,0,0.1\nfc=none\nalpha=0.1",
         bbox=dict(ec=(1,0,0,0.1),
                   fc="none",
                   alpha=0.1,
                   lw=5),)



plt.text(0.6, 0.6, "(d)\nec=1,0,0,0.1\nfc=1,0,0,1\nalpha=1",
         bbox=dict(ec=(1,0,0,0.1),
                   fc=(1,0,0,1),
                   alpha=1,
                   lw=5),)

plt.text(0.6, 0.4, "(e)\nec=1,0,0,1\nfc=1,0,0,0.1\nalpha=0.1",
         bbox=dict(ec=(1,0,0,1),
                   fc=(1,0,0,0.1),
                   alpha=0.1,
                   lw=5),)

plt.text(0.6, 0.2, "(f)\nec=1,0,0,1\nfc=1,0,0,0.1\nalpha=0.1",
         bbox=dict(ec=(1,0,0,1),
                   fc=(1,0,0,0.1),
                   alpha=0.1,
                   lw=5),)


plt.savefig("path-alpha_test.png")
plt.savefig("path-alpha_test.pdf")
plt.show()

<<attachment: path-alpha_test.png>>

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to