Hi David,

The Mac OS X backend does not use Agg, so I am not surprised that this script 
won't work with Mac OS X backend. The script probably also won't work with 
other non-Agg backends such as GtkCairo.

--Michiel.

--- On Mon, 2/15/10, David Arnold <dwarnol...@suddenlink.net> wrote:

> From: David Arnold <dwarnol...@suddenlink.net>
> Subject: [Matplotlib-users] agg_buffer_to_array.py
> To: matplotlib-users@lists.sourceforge.net
> Date: Monday, February 15, 2010, 2:12 PM
> All,
> This error:The
> debugged program raised the exception unhandled AttributeError
> "'FigureCanvasMac' object
> has no attribute 'buffer_rgba'"
> File: 
> /Users/darnold/Documents/temp/Matplotlib/PylabExamples/agg_buffer_to_array.py,
> Line: 16is raised
> by the following script on my Macbook.
> #
> agg_buffer_to_array.py import
> matplotlibmatplotlib.use('macosx')from
> pylab import figure, showimport numpy as
> np
> # make an agg figurefig =
> figure()ax =
> fig.add_subplot(111)ax.plot([1,2,3])ax.set_title('a
> simple figure')fig.canvas.draw()
> # grab rhe pixel buffer and dumpy it into a
> numpy arraybuf =
> fig.canvas.buffer_rgba(0,0)l, b, w, h =
> fig.bbox.boundsX = np.fromstring(buf,
> np.uint8)X.shape = h,w,4
> # now display the array X as an Axes in a new
> figurefig2 = figure()ax2 =
> fig2.add_subplot(111,
> frameon=False)ax2.imshow(X)show()
> This is captured from:  
> http://matplotlib.sourceforge.net/examples/pylab_examples/agg_buffer_to_array.html
> With:
> matplotlib.use('Agg')
> Nothing happens at all. With --verbose-helpful,
> yields the following:
> $HOME=/Users/darnoldCONFIGDIR=/Users/darnold/.matplotlibmatplotlib
> data path
> /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/mpl-dataloaded
> rc file
> /Users/darnold/.matplotlib/matplotlibrcmatplotlib
> version 0.99.1.1verbose.level
> helpfulinteractive is Falseunits is
> Falseplatform is darwinUsing
> fontManager instance from
> /Users/darnold/.matplotlib/fontList.cachebackend
> agg version v2.2findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> to Bitstream Vera Sans
> (/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib-0.98.5.2n2-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
> with score of 0.000000findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=large
> to Bitstream Vera Sans
> (/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/matplotlib-0.98.5.2n2-py2.5-macosx-10.3-fat.egg/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
> with score of 0.000000
> Both
> matplotlib.use('tkagg')
> and
> matplotlib.use('wxagg')
> work as they should.
> David.
> -----Inline Attachment Follows-----
> 
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features
> such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris
> 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 


      

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to