[matplotlib-devel] bug in mathtext eps output

2008-03-18 Thread Mark Bakker
I am trying this problem on the developer's list.
Whenever I type a greek symbol in mathtext and save the figure as eps, the
greek symbols don't show up in the eps file.
Confirmed on several windows machines. Python 2.4. mpl 0.91.2. (but it
worked fine under 0.90.1).
Does anybody else have this problem?
It worked for mpl 0.90.1.
Has something changed in mathtext that causes this?

Mark Bakker
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] axes.py scatter doc-bug

2008-03-18 Thread mdroe
Are you sure it's in the repository and not on a local copy?  I looked 
in both the maintenance branch and the trunk and didn't see this.

Mike

Manuel Metz wrote:
> Hi,
> the doc-string of the axes scatter method is buggy. Somehow the 
> svn-conflict messages got committed to the repository:
> I mean this
>
> <<< .working
> [...]
> ===
> [...]
>  >>> .merge-right.r4987
>
> ... stuff)
>
> Manuel
>
>
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>   


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] blitting and byteswapping a buffer

2008-03-18 Thread Michael Droettboom
Darren Dale wrote:
> I discovered another blitting bug in backend_qt4agg.py. Qt expects a pixmap 
> stringBuffer formatted in ARGB, but mpl formats in RGBA. The qt4 backend 
> usually uses the _renderer.tostring_bgra method to return a properly 
> formatted buffer:
>
> if QtCore.QSysInfo.ByteOrder == QtCore.QSysInfo.LittleEndian:
> stringBuffer = self.renderer._renderer.tostring_bgra()
> else:
> stringBuffer = self.renderer._renderer.tostring_argb()
>
> The problem I am seeing is when we are blitting, and the tostring_bgra is not 
> available.
>  The blitting code in backend_qt4agg.py, starting around line 112, 
> gets a buffer from a region copied from a bbox:
>
> reg = self.copy_from_bbox(bbox)
> stringBuffer = reg.to_string()
> qImage = QtGui.QImage(stringBuffer, w, h, QtGui.QImage.Format_ARGB32)
>
> reg does not have a method to swap the byte order, and Qt does not have a 
> Format_RGBA32. Could anyone suggest how to swap the byte order?
>   
There might be some numpy "trick" to massage the data.  However, it 
looks to me like BufferRegion (in _backend_agg.cpp) needs to grow a 
byte-swapped version of to_string()...  but maybe someone with more 
experience with the Qt backend has a better idea whether this used to 
work and why it may have stopped working.

Cheers,
Mike
> Thanks,
> Darren
>
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>   


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] LineCollection and alpha

2008-03-18 Thread Michael Droettboom
That seems like a reasonable fix.  Fixed in SVN r5003.

Cheers,
Mike

Michael Fitzgerald wrote:
> Hi all,
>
> I found a small bug in LineCollection, which gives an exception when 
> setting alpha.  This is manifested in e.g. hlines and vlines:
>
>> In [1]: hlines((0,),(-1,),(1,),color='b',alpha=0.1)
>> ---
>> IndexErrorTraceback (most recent call 
>> last)
>>
>> XXX/ in ()
>>
>> XXX/lib/python/matplotlib/pyplot.py in hlines(*args, **kwargs)
>>1700 hold(h)
>>1701 try:
>> -> 1702 ret =  gca().hlines(*args, **kwargs)
>>1703 draw_if_interactive()
>>1704 except:
>>
>> XXX/lib/python/matplotlib/axes.py in hlines(self, y, xmin, xmax, 
>> colors, linestyles, label, **kwargs)
>>2609 linestyles=linestyles, 
>> label=label)
>>2610 self.add_collection(coll)
>> -> 2611 coll.update(kwargs)
>>2612
>>2613 minx = min(xmin.min(), xmax.min())
>>
>> XXX/lib/python/matplotlib/artist.py in update(self, props)
>> 438 if func is None or not callable(func):
>> 439 raise AttributeError('Unknown property %s'%k)
>> --> 440 func(v)
>> 441 changed = True
>> 442 self.eventson = store
>>
>> XXX/lib/python/matplotlib/collections.py in set_alpha(self, alpha)
>> 306 else:
>> 307 artist.Artist.set_alpha(self, alpha)
>> --> 308 self._facecolors[:, 3] = alpha
>> 309 self._edgecolors[:, 3] = alpha
>> 310
>>
>> IndexError: invalid index
>
>
> This appears to be because LineCollection.__init__() only uses 
> Collection._edgecolors, and sets _facecolors to an empty array.  I 
> don't know if it's the proper solution, but I did this to get it to work:
>
> Index: lib/matplotlib/collections.py
> ===
> --- lib/matplotlib/collections.py   (revision 5000)
> +++ lib/matplotlib/collections.py   (working copy)
> @@ -305,7 +305,8 @@
>  except TypeError: raise TypeError('alpha must be a float')
>  else:
>  artist.Artist.set_alpha(self, alpha)
> -self._facecolors[:, 3] = alpha
> +if len(self._facecolors):
> +self._facecolors[:, 3] = alpha
>  self._edgecolors[:, 3] = alpha
>
>  def get_linewidths(self):
>
>
> Best,
> Mike
>
> 
>
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> 
>
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>   


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] pcolor curiosity

2008-03-18 Thread Michael Droettboom
Ryan May wrote:
> Eric Firing wrote:
>   
>> Ryan,
>>
>> The pcolor implementation is fundamentally unsuited to large arrays. 
>> Therefore I made the pcolorfast axes method, which tries to use the 
>> fastest available Agg extension code, depending on the characteristics 
>> of the spatial grid.  If the grid is rectangular and regular in both 
>> directions it uses a slight modification of the image code; if it is 
>> rectangular but with irregular spacing, it uses the nonuniform image 
>> code; and if it is not rectangular it uses the quadmesh code.  It sounds 
>> like what you need is the quadmesh version, which you can access either 
>> via pcolormesh or pcolorfast.  Neither is exposed via the pylab or 
>> pyplot API at present; both are axes methods.  The pcolorfast API also 
>> may change slightly in the future; it probably needs a little more work.
>> 
>
> Yeah, I think for purposes of plotting radar data, quadmesh is what i need.
>
>   
>> The quadmesh code has problems with masked arrays in the released 
>> version of mpl, but not in the svn version.  It is *much* faster than 
>> pcolor, but may not be fast enough for your needs.
>> 
>
> My latest testing with the trunk with both pcolorfast and pcolormesh 
> would seem to indicate that it's still a bit too slow for me.
>
>   
>> If you are looking into what sounds like an OpenGL backend, or component 
>> to a backend, then the place to start is still probably pcolormesh or 
>> pcolorfast, not pcolor.
>> 
> This is the approach I'm considering.  I've been poking around, and 
> managed to create something that rendered, but not too well.  However 
> this was basically modifying the Gtk backend, and I'm sure there are 
> some Gtk things that could be replaced.  I noticed there are some other 
> draw_* methods in other backends that aren't in the gtk, like 
> draw_quad_mesh and draw_rectangle.  Is there a definitive list 
> somewhere?  I tried RendererBase in backend_bases, but it did not have 
> draw_rectangle.
The pure Gtk backend has no optimizations for draw_quad_mesh.  You may 
find that the Agg (e.g. GtkAgg) backend is significantly faster with 
quad meshes because it uses optimized C++ code to draw the mesh.  The 
Gtk version must make (as you discovered) a Python function call for 
each quadrilateral. 

The definitive list of methods on rendering backends is in 
backend_bases.py.  There are "required" methods, and methods that may be 
provided for optimization reasons (the latter are the ones that mention 
having a "fallback" implementation in RendererBase).

Hope that helps,
Mike


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] [Fwd: axes.py scatter doc-bug]

2008-03-18 Thread Michael Droettboom
Sorry -- I see it now.  Disregard my earlier message.  It is now fixed 
in SVN r5004.

Manuel Metz wrote:
> Happend with your commit from version 4979 -> 4989. Who's going to fix 
> that ? Whom can I directly contact ?
>
>  Original Message 
> Subject: [matplotlib-devel] axes.py scatter doc-bug
> Date: Wed, 12 Mar 2008 12:30:12 +0100
> From: Manuel Metz <[EMAIL PROTECTED]>
> To: matplotlib-devel@lists.sourceforge.net
> CC: John Hunter <[EMAIL PROTECTED]>
>
> Hi,
> the doc-string of the axes scatter method is buggy. Somehow the
> svn-conflict messages got committed to the repository:
> I mean this
>
> <<< .working
> [...]
> ===
> [...]
>  >>> .merge-right.r4987
>
> ... stuff)
>
> Manuel
>
>
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] blitting and byteswapping a buffer

2008-03-18 Thread Darren Dale
On Tuesday 18 March 2008 02:30:29 pm Michael Droettboom wrote:
> Darren Dale wrote:
> > I discovered another blitting bug in backend_qt4agg.py. Qt expects a
> > pixmap stringBuffer formatted in ARGB, but mpl formats in RGBA. The qt4
> > backend usually uses the _renderer.tostring_bgra method to return a
> > properly formatted buffer:
> >
> > if QtCore.QSysInfo.ByteOrder == QtCore.QSysInfo.LittleEndian:
> > stringBuffer = self.renderer._renderer.tostring_bgra()
> > else:
> > stringBuffer = self.renderer._renderer.tostring_argb()
> >
> > The problem I am seeing is when we are blitting, and the tostring_bgra is
> > not available.
> >  The blitting code in backend_qt4agg.py, starting around line 112,
> > gets a buffer from a region copied from a bbox:
> >
> > reg = self.copy_from_bbox(bbox)
> > stringBuffer = reg.to_string()
> > qImage = QtGui.QImage(stringBuffer, w, h, QtGui.QImage.Format_ARGB32)
> >
> > reg does not have a method to swap the byte order, and Qt does not have a
> > Format_RGBA32. Could anyone suggest how to swap the byte order?
>
> There might be some numpy "trick" to massage the data.  However, it
> looks to me like BufferRegion (in _backend_agg.cpp) needs to grow a
> byte-swapped version of to_string()...  but maybe someone with more
> experience with the Qt backend has a better idea whether this used to
> work and why it may have stopped working.

Thanks for responding. I don't think it ever worked properly with the Qt 
backends. I just dropped back to the maintenance branch to check the 
following script:

from matplotlib import rcParams
rcParams['backend']='qt4agg'
from pylab import *
from matplotlib.widgets import Cursor
ax=axes()
ax.plot([1, 2, 3, 4, 5], 'ro', ms=10)
cursor = Cursor(ax, useblit=True)
show()

and it shows the same behavior.

Darren

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel