SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: John H. <jd...@gm...> - 2007年02月28日 23:48:33
a doughnut to the developer who can figure this one out for me!
If you resize the figure window slightly, the alpha channel gets
whacked on the rectangles. This only happens if the legend is added
to the axes -- comment that out and the alpha channel is fine. I
suspect we are screwing up somewhere in the way we copy properties
from legended objects to their legend proxies (ie we are reversing
this somewhere and copying properties from a proxy to the axes
The problem is in svn and probably earlier releases but I haven't tested.
from pylab import figure, show, cm, nx
from matplotlib.patches import Rectangle
fig = figure()
ax = fig.add_subplot(111, axisbelow=True)
ax.grid(True)
ax.plot([1,2,3,4,5,6,7])
ax.axvspan(1,2, facecolor='red', alpha=0.5)
ax.axvspan(3,4, facecolor='green', alpha=0.5)
red = Rectangle((0,0), 1, 1, facecolor='red', alpha=0.5)
green = Rectangle((0,0), 1, 1, facecolor='green', alpha=0.5)
# comment out next line and bug goes away!
ax.legend((red, green), ('red', 'green'), loc='best')
show()
From: <jk...@ik...> - 2007年03月01日 01:37:33
"John Hunter" <jd...@gm...> writes:
> I suspect we are screwing up somewhere in the way we copy properties
> from legended objects to their legend proxies (ie we are reversing
> this somewhere and copying properties from a proxy to the axes
Here's at least a clue: change your alphas from 0.5 to 0.1. Then
resize the window several times and watch the rectangles become 
a little bit darker each time. I suspect that extra copies of the
rectangles are being created.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: <jk...@ik...> - 2007年03月01日 10:13:21
I committed the following change, which seems to fix the bug.
Index: legend.py
===================================================================
--- legend.py (revision 3031)
+++ legend.py (working copy)
@@ -315,7 +315,7 @@
 raise Exception, 'Auto legends not available for figure legends.'
 
 def get_handles(ax):
- handles = ax.lines
+ handles = ax.lines[:]
 handles.extend(ax.patches)
 handles.extend([c for c in ax.collections if isinstance(c, LineCollection)])
 
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: John H. <jd...@gm...> - 2007年03月01日 15:15:46
On 3/1/07, Jouni K. Sepp=E4nen <jk...@ik...> wrote:
> I committed the following change, which seems to fix the bug.
> - handles =3D ax.lines
> + handles =3D ax.lines[:]
Wow, nasty and subtle. Good work! Now how do I get a doughnut to you
in Finland :-) Any ideas Perry?
JDH
From: Perry G. <pe...@st...> - 2007年03月01日 15:23:49
On Mar 1, 2007, at 10:15 AM, John Hunter wrote:
> On 3/1/07, Jouni K. Sepp=E4nen <jk...@ik...> wrote:
>> I committed the following change, which seems to fix the bug.
>
>> - handles =3D ax.lines
>> + handles =3D ax.lines[:]
>
> Wow, nasty and subtle. Good work! Now how do I get a doughnut to you
> in Finland :-) Any ideas Perry?
What, you didn't like the way I did it? ;-)=
From: John H. <jd...@gm...> - 2007年03月01日 15:25:18
On 3/1/07, Perry Greenfield <pe...@st...> wrote:
> What, you didn't like the way I did it? ;-)
Actually, I think I saved that in the freezer still in the envelope as
a memento -- maybe I can just send that one on to save the dollar!
JDH
From: <jk...@ik...> - 2007年03月01日 15:53:56
"John Hunter" <jd...@gm...> writes:
> Actually, I think I saved that in the freezer still in the envelope as
> a memento -- maybe I can just send that one on to save the dollar!
That sounds like something that could get me in trouble with Finnish
customs officials. I may have an opportunity to visit San Jose in
August -- that's at least on the same continent as you, right? :-)
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /