From: Eric Firing<efiring@...229...>
Subject: Re: [matplotlib-devel] graphics context: use alpha value from foreground color if present
Date: Friday, August 26, 2011, 10:20 PM
On 08/26/2011 06:23 AM, Michiel de >> Hoon wrote:
I am currently modifying the MacOSX backend to make
its interactive/non-interactive behavior consistent with the
other backends in matplotlib.
When I was testing the backend, I found a new bug that
seems to be related to a recent change in backend_bases.py:
Thank you for doing this work on the MacOSX backend; sorry
introduced a bug that you stumbled over.
After this commit, GraphicsContextBase.set_alpha has
no effect if alpha==None; previously it would set alpha to
The bug appears here in Text.draw in text.py:
In this code, self is a Text object, which derives
from the Artist class, which initializes its _alpha member
to None. So self.get_alpha() returns None, and gc.set_alpha
has no effect. The alpha value used then depends on whatever
was present in the gc before the call to new_gc, which is
backend-dependent; the MacOSX and cairo backends end up with
an incorrect alpha value.
I guess the easiest solution is to initialize _alpha
in the Artist class to 1.0 instead of to None.
The problem was occurring because the macosx and cairo
recycling their graphics context objects instead of making
instances, so they were not getting initialized. I
made a local fix by
initializing the _alpha attributes; it may be that other
is actually needed as well, and that the
method should be called, but I have not looked into
that. The small fix
solves the immediate problem.
In addition, I realized that a small change in
needed to properly support backends that have their own
set_foreground methods in their gc class.
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified
Up to 160% more powerful than alternatives and 25% more
Matplotlib-devel mailing list