Bug in legend?

Hi List,

I think I found a bug in legend of a fill command (see attached code and figure) when the facecolor is 'none' but the alpha is not None (I'm using latest matplotlib 1.1.0). If confirmed, should I fill in a but report?

Cheers,

bug_fc.py (350 Bytes)

bug_fc.png

···

--
    .~. Yannick COPIN (o:>* Doctus cum libro
    /V\ Institut de physique nucleaire de Lyon (IN2P3 - France)
   // \\ Tel: (33/0) 472 431 968 AIM: YnCopin ICQ: 236931013
  /( )\ http://snovae.in2p3.fr/ycopin/
   ^`~'^

I see identical behavior in Christoph Gohlke's Windows build of
Matplotlib 1.2.X for Python 3.2.

The same thing occurs if you remove the "alpha=None" altogether.
-paul

···

On Mon, Apr 16, 2012 at 4:58 AM, Yannick Copin <yannick.copin@...547...> wrote:

Hi List,

I think I found a bug in legend of a fill command (see attached code and
figure) when the facecolor is 'none' but the alpha is not None (I'm using
latest matplotlib 1.1.0). If confirmed, should I fill in a but report?

Handling alpha can become very tricky with matplotlib.
The problem is not specific for legend thing, but how attribute of
patches are updated when the update_from method is called.
Here is an example.

  from matplotlib.patches import Patch

  pa1 = Patch(alpha=None, fc='none', ec='b')
  pb1 = Patch(alpha=1, fc='none', ec='b')

  pa2 = Patch()
  pb2 = Patch()

  pa2.update_from(pa1)
  pb2.update_from(pb1)

  assert pa1.get_fc() == pa2.get_fc()
  assert pb1.get_fc() == pb2.get_fc()

And the second assertion fails.
fc="none" sets facecolor to (0,0,0,0) but when update_from is called,
somehow its alpha value is overridden to 1 (because of alpha=1).
This seems to be a bug and maybe we need to tweak the update_from
method to get it right. But others may think differently. I'll file an
issue with it.

Meanwhile, please explicitly set fill=False to avoid filling. e.g.,

  ax.fill(y,x, label='alpha=1', alpha=0.5, fc='none', ec='r', fill=False)

Regards,

-JJ

···

On Tue, Apr 17, 2012 at 12:49 AM, Paul Hobson <pmhobson@...287...> wrote:

On Mon, Apr 16, 2012 at 4:58 AM, Yannick Copin > <yannick.copin@...547...> wrote:

Hi List,

I think I found a bug in legend of a fill command (see attached code and
figure) when the facecolor is 'none' but the alpha is not None (I'm using
latest matplotlib 1.1.0). If confirmed, should I fill in a but report?

I see identical behavior in Christoph Gohlke's Windows build of
Matplotlib 1.2.X for Python 3.2.

The same thing occurs if you remove the "alpha=None" altogether.
-paul

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options