Re: [Matplotlib-users] Possible bug with contour, alpha blending and vector output

2010-01-30 Thread Jouni K . Seppänen
Moving to the devel list, since this concerns an internal API of
matplotlib. Thanks to Sourav for reporting this and to Eric for sending
the note to me.

Eric Firing efir...@hawaii.edu writes:

 Sourav K. Mandal wrote:
 I have a simple problem: when outputting to PDF or SVG, alpha blending
 does not work for the lines drawn by contour.  However, alpha blending
 does work for the regions given by contourf.  

 You are right, this is a real bug, verified in svn.  

The contour function creates a LineCollection, which gets drawn via
draw_path_collection, which the pdf backend inherits from backend_bases.
The default draw_path_collection (or _iter_collection really)
communicates the alpha of the *face color* only by setting the alpha
attribute of the GraphicsContext:

if rgbFace is not None and len(rgbFace)==4:
gc0.set_alpha(rgbFace[-1])
rgbFace = rgbFace[:3]

The alpha of the line only gets communicated via the fourth component of
the rgb attribute of the GraphicsContext, and currently the pdf backend
doesn't do anything with it.

I think this could be resolved in a number of ways, none of which is
obviously the perfect solution:

1. Add a check in _iter_collection for gc0._rgb having an alpha
   component, similar to the current check for rgbFace, and set the
   alpha attribute from that one too. (What if both rgbFace and gc0._rgb
   have an alpha component?)

2. Make each backend's GraphicsContext set the alpha attribute from the
   color. (If the alpha attribute is already set, how should they be
   combined? Multiply, take the minimum, or what?)

3. Either get rid of the alpha attribute on the GraphicsContext and use
   only rgba tuples within backends, or turn it into two attributes
   (e.g. alphaFace and alphaStroke). (What to do with the frontend's
   single alpha attribute?)

By the way, I have never really understood why rgbFace is given
separately from the GraphicsContext. Is this just an evolutionary
remnant or is there a deeper meaning for it?

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Possible bug with contour, alpha blending and vector output

2010-01-28 Thread Sourav K. Mandal
Hello,

I am using Matplotlib version 0.99.1.1.

I have a simple problem: when outputting to PDF or SVG, alpha blending
does not work for the lines drawn by contour.  However, alpha blending
does work for the regions given by contourf.  

Both work when outputting to PNG.

My Python script (and data file) and example output (PDF, SVG, PNG) are
posted here:

http://panic.berkeley.edu/~smandal/

Thank you!


Regards,

Sourav







--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Possible bug with contour, alpha blending and vector output

2010-01-28 Thread Eric Firing
Sourav K. Mandal wrote:
 Hello,
 
 I am using Matplotlib version 0.99.1.1.
 
 I have a simple problem: when outputting to PDF or SVG, alpha blending
 does not work for the lines drawn by contour.  However, alpha blending
 does work for the regions given by contourf.  
 

You are right, this is a real bug, verified in svn.  Since the agg 
backend works correctly and the pdf and svg backends do not, it appears 
to be essentially a bug in those backends.  I am calling this to Jouni's 
attention, since he is the pdf backend expert; but in case neither he 
nor anyone else can get to it right away, if you have not seen any other 
response within a day, please file a bug report on the tracker so this 
doesn't get lost.  If you do so, please use a simple and completely 
self-contained script to illustrate the problem.

http://sourceforge.net/tracker/?group_id=80706

Thank you.

Eric

 Both work when outputting to PNG.
 
 My Python script (and data file) and example output (PDF, SVG, PNG) are
 posted here:
 
 http://panic.berkeley.edu/~smandal/
 
 Thank you!
 
 
 Regards,
 
 Sourav
 
 
 
 
 
 
 
 --
 The Planet: dedicated and managed hosting, cloud storage, colocation
 Stay online with enterprise data centers and the best network in the business
 Choose flexible plans and management services without long-term contracts
 Personal 24x7 support from experience hosting pros just a phone call away.
 http://p.sf.net/sfu/theplanet-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users