LaTeX, eps, ghostscript, and the like

This was a font problem I was having in LaTeX compilation. Many of the issues that you and I are having are slightly beyond mpl, and have to do with different ways different versions of LaTeX deal with fonts, etc. The change to texmanager.py (below) was to not load the fontenc package. When this package was loaded, LaTeX was producing illegible postscript (for reasons I don't entirely understand). This was *separate* from the dvipng hack, which was required for me to get decent bitmapped images. The excluding the fontenc package is required for EPS (vector) output, so these two issues are completely separate.

I have never been able to get .ps files that will convert to .pdf using adobe distiller. Always get a font related error and distiller bails.
But the .eps files work fine for converting to .pdf.
So if I comment out fontenc, will that break .eps but fix .ps?

···

On 09 Feb, 2006, at 08:58, Robert Hetland wrote:

The texmanager.py simply performs a number of LaTeX opperations. The best advice I got was to try to do as much of this by hand as possible, to see where the potential problems lie. Turn on the debug-annoying to see everything that mpl is doing while it creates your plots.

-Rob

On Feb 9, 2006, at 8:59 AM, Samuel M. Smith wrote:

what is this doing differently than the 1.6 hack?
what is wrong with the eps files?

  Also, commenting out line 141 in texmanager:

        self._font_preamble = '\n'.join([r'\usepackage{type1cm}',
                             cmd,
# r'\usepackage[T1]{fontenc}', # The guilty line
                             r'\usepackage{textcomp}'])k

allowed me to save EPS files that work very well.

Finally, for those of you interested in editing EPS files in Illustrator, you need to worry about the absence of the Computer Modern fonts in Adobe products. This link (really work checking out if you do scientific graphics on a Mac) explains how to get everything working for Illustrator CS and CS2:

-----
Rob Hetland, Assistant Professor
Dept of Oceanography, Texas A&M University
p: 979-458-0096, f: 979-845-6331
e: hetland@...760..., w: http://pong.tamu.edu

**********************************************************************
Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84043
801-768-2768 voice
801-768-2769 fax
**********************************************************************
"The greatest source of failure and unhappiness in the world is
giving up what we want most for what we want at the moment"
**********************************************************************

Well, no. In my experience, this fixes EPS (which is otherwise broken). I also got the xpdf distiller to work, which places the fonts in the file – good for editing in Illustrator later.

-Rob

···

On Feb 9, 2006, at 10:35 AM, Samuel M. Smith wrote:

So if I comment out fontenc, will that break .eps but fix .ps?


Rob Hetland, Assistant Professor

Dept of Oceanography, Texas A&M University

p: 979-458-0096, f: 979-845-6331

e: hetland@…760…, w: http://pong.tamu.edu

Getting this result was extremely important to me. I believe that some
journals will insist on being able to open the image in, say, adobe
illustrator, so they can change the fonts.

···

On Thursday 09 February 2006 12:21, Robert Hetland wrote:

On Feb 9, 2006, at 10:35 AM, Samuel M. Smith wrote:
> So if I comment out fontenc, will that break .eps but fix .ps?

Well, no. In my experience, this fixes EPS (which is otherwise
broken). I also got the xpdf distiller to work, which places the
fonts in the file -- good for editing in Illustrator later.

I wanted to test out all the tex related fixes that are in matplotlib 0.87.
Since I couldn't find a binary distribution anywhere I tried building it from source.

I have python 2.4.2 framework
wxPython 2.6.2.1

I have zlib, freetype, and libpng installed

I downloaded 0.87
ran
python setup.py build

there were no errors but a few warnings about mulitiply defined types that seemed innocuous
This warning was the only one that seemed like it might be a problem.

rc/_tkagg.cpp: In function `int PyAggImagePhoto(void*, Tcl_Interp*, int,
    char**)':
src/_tkagg.cpp:71: warning: unused variable `int srcstride'
src/_tkagg.cpp:72: warning: unused variable `int srcwidth'
gcc: -framework: linker input file unused because linking not done
gcc: Tcl: linker input file unused because linking not done
gcc: -framework: linker input file unused because linking not done
gcc: Tk: linker input file unused because linking not done

I ran
sudo python setup.py install

no problems.

but when I try to do a simple plot I get the following error

ipython -pylab

In [4]: plot([4,3,2])

···

---------------------------------------------------------------------------
exceptions.MemoryError Traceback (most recent call last)

/Install/Python/MacPython/Python2.4.2/MatPlotLib/matplotlib-0.87/<ipython console>

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py in plot(*args, **kwargs)
    2128 try:
    2129 ret = gca().plot(*args, **kwargs)
-> 2130 draw_if_interactive()
    2131 except:
    2132 hold(b)

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/IPython/genutils.py in wrapper(*args, **kw)
     802 def wrapper(*args,**kw):
     803 wrapper.called = False
--> 804 out = func(*args,**kw)
     805 wrapper.called = True
     806 return out

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py in draw_if_interactive()
    1170 figManager = Gcf.get_active()
    1171 if figManager is not None:
-> 1172 figManager.canvas.draw()
    1173
    1174

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py in draw(self, repaint)
      60 FigureCanvasAgg.draw(self)
      61
---> 62 self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
      63 if repaint:
      64 self.gui_repaint()

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap

any ideas?

Samuel M. Smith wrote:

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap

yes, if you are running OS-X 10.4. OS-X 10.4 comes with a version of wxPython pre-installed. It's an older version that you probably don't want to use, plus it's installed for python 2.3.5

However, when you need to build wx code (which the wxagg back-end does), you can use the wx-config utility to find out what libs to link etc. Apple has installed a wx-config into /usr/bin/wx-config that points to their install of wx. You need to make sure MPL uses the wx-config that came with the version of wxPython you installed instead.

I think it's in /usr/local/lib/wxPython-Something-or-other/bin/wxconfig

There is an environment variable you can set to tell MPL's setup.py where to look for it. It escapes me for the moment what it's called, but poke around setup.py and friends and you'll find it.

When you've got this all working, it would be great if you could contribute a binary mpkg to pythonmac.org.

How did you link libpng and libfreetype? Statically I hope, so that a binary would be useful to everyone.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

I found wx-config in
/usr/local/lib/wxPython-ansi-2.6.2.1/bin

./wx-config --version
2.6.2

there is another wx-config in /usr/bin that returns 2.5.3 for the version

in setupext.py is the following function

def find_wx_config():
     """If the WX_CONFIG environment variable has been set, returns it value.
     Otherwise, search for `wx-config' in the PATH directories and return the
     first match found. Failing that, return None.
     """

     wxconfig = os.getenv('WX_CONFIG')
     if wxconfig is not None:
         return wxconfig

     path = os.getenv('PATH') or ''
     for dir in path.split(':'):
         wxconfig = os.path.join(dir, 'wx-config')
         if os.path.exists(wxconfig):
             return wxconfig

     return None

I checked and I didn't have WX_CONFIG environment variable set to anything.

so I set the environment variable

export WX_CONFIG="usr/local/lib/wxPython-ansi-2.6.2.1/bin/wx-config"
AlBook:smithsm$ echo $WX_CONFIG
usr/local/lib/wxPython-ansi-2.6.2.1/bin/wx-config

I removed the build directory rm -r build then I
python setup.py clean
python setup.py build
sudo python setup.py clean

but the problem does not go away!
  from the debug output below it states that
the WXAgg backend is version 2.6.2.1
So I don't know what to do?

pythonw simple_plot.py --verbose-helpful
matplotlib data path /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data
$HOME=/Users/smithsm
CONFIGDIR=/Users/smithsm/.matplotlib
loaded rc file /Users/smithsm/.matplotlib/matplotlibrc
matplotlib version 0.87.1cvs
verbose.level helpful
interactive is False
platform is darwin
numerix numpy 0.9.5.2006
font search path ['/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data']
loaded ttfcache file /Users/smithsm/.matplotlib/ttffont.cache
backend WXAgg version 2.6.2.1
Traceback (most recent call last):
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py", line 1048, in _onPaint
     self.draw(repaint=False)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py", line 62, in draw
     self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap
Traceback (most recent call last):
   File "simple_plot.py", line 16, in ?
     show()
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py", line 1193, in show
     figwin.canvas.draw()
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py", line 62, in draw
     self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap
AlBook:smithsm$

···

On 24 Feb, 2006, at 15:33, Christopher Barker wrote:

Samuel M. Smith wrote:

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap

yes, if you are running OS-X 10.4. OS-X 10.4 comes with a version of wxPython pre-installed. It's an older version that you probably don't want to use, plus it's installed for python 2.3.5

However, when you need to build wx code (which the wxagg back-end does), you can use the wx-config utility to find out what libs to link etc. Apple has installed a wx-config into /usr/bin/wx-config that points to their install of wx. You need to make sure MPL uses the wx-config that came with the version of wxPython you installed instead.

I think it's in /usr/local/lib/wxPython-Something-or-other/bin/wxconfig

There is an environment variable you can set to tell MPL's setup.py where to look for it. It escapes me for the moment what it's called, but poke around setup.py and friends and you'll find it.

When you've got this all working, it would be great if you could contribute a binary mpkg to pythonmac.org.

How did you link libpng and libfreetype? Statically I hope, so that a binary would be useful to everyone.

-Chris

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

**********************************************************************
Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84043
801-768-2768 voice
801-768-2769 fax
**********************************************************************
"The greatest source of failure and unhappiness in the world is
giving up what we want most for what we want at the moment"
**********************************************************************

Setting the WX_CONFIG environment variable before the build fixed one problem. It is now finding my matplotlibrc file.

I thought maybe it was a font corruption problem but it I use TkAgg everything works fine with my 0.87.1cvs build. So
I think maybe I have uncovered a bug in the WXAgg? I would like to help fix it but I don't have a clue of where to start.

I also tried WxAgg with the first fonts in the rc file set to the ones that come installed with matplotlib
font.serif : Bitstream Vera Serif
font.sans-serif : Bitstream Vera Sans

and it still crashes. So something is wrong. Maybe its my environment. It would be nice if someone could verify
if they get the same problem

Here is the debug output

AlBook:smithsm$ ipython -pylab
loaded rc file /Users/smithsm/.matplotlib/matplotlibrc
matplotlib version 0.87.1cvs
verbose.level debug
interactive is False
platform is darwin
loaded modules: ['IPython.Prompts', '_bisect', 'distutils', 'IPython.iplib', 'IPython.signal', 'random', 'IPython.FakeModule', 'datetime', 'matplotlib.tempfile', 'IPython.bdb', 'distutils.sysconfig', 'pytz.datetime', 'IPython.time', 'struct', 're', 'tempfile', 'pprint', 'IPython.copy_reg', 'imp', 'IPython.OInspect', 'collections', 'IPython.pydoc', 'IPython.cStringIO', 'zipimport', 'IPython.codecs', 'string', 'matplotlib.dateutil', 'IPython.imp', 'repr', 'matplotlib.__future__', 'pytz.tzinfo', 'IPython.Itpl', 'IPython.Debugger', 'new', 'distutils.re', 'IPython.excolors', 'IPython.Queue', 'IPython.os', 'resource', 'bisect', 'IPython.glob', 'signal', 'cmd', 'pydoc', 'threading', 'token', 'shlex', 'pytz.bisect', 'IPython.shlex', 'matplotlib.pytz', 'IPython.exceptions', 'IPython.new', 'dis', 'cStringIO', 'locale', 'IPython.path', 'Queue', 'IPython.types', 'atexit', 'IPython.commands', 'encodings', 'IPython.threading', 'bdb', 'IPython.ConfigLoader', 'matplotlib.warnings', 'matplotlib.sys', 'encodings.types', 'posix', 'encodings.ascii', 'math', 'IPython.platutils_dummy', 'fcntl', 'IPython.profile', 'IPython.platutils_win32', 'dateutil', 'optparse', 'UserDict', 'inspect', 'distutils.os', 'matplotlib', 'IPython.hooks', 'exceptions', 'codecs', 'getopt', 'md5', 'IPython.ColorANSI', 'commands', 'socket', 'thread', 'sre', 'IPython.StringIO', 'traceback', 'IPython.pstats', 'pkg_resources', 'itertools', 'opcode', 'pstats', 'IPython.tokenize', 'distutils.sys', 'os', 'pdb', 'IPython.traceback', '__future__', '_sre', 'IPython.Shell', '__builtin__', 'IPython', 'distutils.string', 'matplotlib.datetime', 'IPython.codeop', 'posixpath', 'popen2', 'errno', '_socket', 'binascii', 'IPython.sys', 'IPython.re', 'sre_constants', 'IPython.platutils_posix', 'IPython.PyColorize', 'matplotlib.md5', 'types', 'IPython.genutils', 'tokenize', 'IPython.pdb', 'cPickle', 'pytz.sys', 'IPython.platutils', 'IPython.macro', '_codecs', 'IPython.token', '_locale', 'IPython.keyword', 'IPython.IPython', 'IPython.string', 'pytz', 'IPython.__builtin__', 'copy', 'matplotlib.os', 'IPython.socket', 'IPython.resource', 'IPython.cmd', 'keyword', 'StringIO', 'IPython.linecache', 'IPython.__main__', 'encodings.aliases', 'fnmatch', 'sre_parse', 'IPython.ultraTB', 'IPython.tempfile', 'IPython.Release', 'IPython.OutputTrap', 'copy_reg', 'sre_compile', '_random', 'site', 'IPython.getopt', 'IPython.ipstruct', 'IPython.inspect', '__main__', 'shutil', 'IPython.Magic', 'IPython.pprint', 'strop', 'IPython.bisect', 'IPython.textwrap', 'IPython.shutil', 'encodings.codecs', 'gettext', 'IPython.Logger', 'IPython.fnmatch', 'encodings.exceptions', 'pytz.sets', 'profile', 'IPython.wildcard', 'stat', '_ssl', 'warnings', 'IPython.deep_reload', 'glob', 'sets', 'textwrap', 'sys', 'IPython.ipmaker', 'codeop', 'os.path', 'IPython.background_jobs', 'IPython.DPyGetOpt', 'IPython.cPickle', 'IPython.usage', 'matplotlib.distutils', 'distutils.errors', 'marshal', 'IPython.__future__', 'linecache', 'matplotlib.shutil', 'time', 'IPython.ipapi']
numerix numpy 0.9.5.2006
font search path ['/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data']
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/cmtt10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/VeraMoBd.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/VeraMoBI.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/VeraBd.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/VeraSeBd.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/VeraMono.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/cmsy10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/cmex10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/cmmi10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/VeraIt.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/cmr10.ttf
trying fontname /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data/Vera.ttf
$HOME=/Users/smithsm
CONFIGDIR=/Users/smithsm/.matplotlib
loaded ttfcache file /Users/smithsm/.matplotlib/ttffont.cache
matplotlib data path /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data
backend WXAgg version 2.6.2.1
Python 2.4.2 (#3, Jan 8 2006, 20:33:07)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.1.fix1 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

   Welcome to pylab, a matplotlib-based Python environment.
   For more information, type 'help(pylab)'.

In [1]: plot([-2.345,-12.349])

···

---------------------------------------------------------------------------
exceptions.MemoryError Traceback (most recent call last)

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py in _onPaint(self, evt)
    1046 self.realize()
    1047 # Render to the bitmap
-> 1048 self.draw(repaint=False)
    1049 # Update the display using a PaintDC
    1050 self.gui_repaint(drawDC=wx.PaintDC(self))

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py in draw(self, repaint)
      60 FigureCanvasAgg.draw(self)
      61
---> 62 self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
      63 if repaint:
      64 self.gui_repaint()

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap
---------------------------------------------------------------------------
exceptions.MemoryError Traceback (most recent call last)

/Install/Python/MacPython/Python2.4.2/MatPlotLib/examples/<ipython

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py in plot(*args, **kwargs)
    2122 def plot(*args, **kwargs):
    2123 # allow callers to override the hold state by passing hold=True|False
-> 2124 b = ishold()
    2125 h = popd(kwargs, 'hold', None)
    2126 if h is not None:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py in ishold()
     962 Return the hold status of the current axes
     963 """
--> 964 return gca().ishold()
     965
     966 def isinteractive():

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py in gca(**kwargs)
     913 """
     914
--> 915 ax = gcf().gca(**kwargs)
     916 return ax
     917

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py in gcf()
     923 return figManager.canvas.figure
     924 else:
--> 925 return figure()
     926
     927 def gci():

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py in figure(num, figsize, dpi, facecolor, edgecolor, frameon)
     893 figManager.canvas.figure.number = num
     894
--> 895 draw_if_interactive()
     896 return figManager.canvas.figure
     897

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/IPython/genutils.py in wrapper(*args, **kw)
     802 def wrapper(*args,**kw):
     803 wrapper.called = False
--> 804 out = func(*args,**kw)
     805 wrapper.called = True
     806 return out

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py in draw_if_interactive()
    1170 figManager = Gcf.get_active()
    1171 if figManager is not None:
-> 1172 figManager.canvas.draw()
    1173
    1174

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py in draw(self, repaint)
      60 FigureCanvasAgg.draw(self)
      61
---> 62 self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
      63 if repaint:
      64 self.gui_repaint()

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap

In [2]: ---------------------------------------------------------------------------
exceptions.MemoryError Traceback (most recent call last)

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py in _onPaint(self, evt)
    1046 self.realize()
    1047 # Render to the bitmap
-> 1048 self.draw(repaint=False)
    1049 # Update the display using a PaintDC
    1050 self.gui_repaint(drawDC=wx.PaintDC(self))

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py in draw(self, repaint)
      60 FigureCanvasAgg.draw(self)
      61
---> 62 self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
      63 if repaint:
      64 self.gui_repaint()

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap

Sam,

I wish I could be more help,. but maybe I can help steer your efforts bit:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py in draw(self, repaint)
     60 FigureCanvasAgg.draw(self)
     61
---> 62 self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
     63 if repaint:
     64 self.gui_repaint()

MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap

This sure looks like your error occurs when MPL is trying to convert from the wxagg internal image storage to a wxBitmap. As a test, I'd make sure the pure Agg back-end works fine (have it create a PNG). If so then font,s etc have nothing to do withyour trouble...it's all about the agg -> wx conversion. that's why I thought it could be caused by liniking to the wrong version of wx.

to make sure you have linked to the right version, you can use:

otool -L

on the wxagg libs that MPL builds. That should tell you which wx libs you've actuallylinked to.

With any luck, I'll have a chance to try to get this working on my system this week, and then maybe I'll be more help.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

Onsi Fakhouri had the same problem and found a workaround. But I appreciate your help
the WX_AGG environment variable fixed one problem and your information on the linking tool should prove useful
to verify that things are getting build correctly.

See my post today titled "Workaround for 0.87 WXAgg bug".
Apparently according to Onsi
  there is a bug in the C code, memory is not being allocated correctly.

···

On 27 Feb, 2006, at 10:24, Christopher Barker wrote:

Sam,

I wish I could be more help,. but maybe I can help steer your efforts bit:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py in draw(self, repaint)
     60 FigureCanvasAgg.draw(self)
     61
---> 62 self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
     63 if repaint:
     64 self.gui_repaint()
MemoryError: _wxagg.convert_agg_to_wx_bitmap(): could not create the wx.Bitmap

This sure looks like your error occurs when MPL is trying to convert from the wxagg internal image storage to a wxBitmap. As a test, I'd make sure the pure Agg back-end works fine (have it create a PNG). If so then font,s etc have nothing to do withyour trouble...it's all about the agg -> wx conversion. that's why I thought it could be caused by liniking to the wrong version of wx.

to make sure you have linked to the right version, you can use:

otool -L

on the wxagg libs that MPL builds. That should tell you which wx libs you've actuallylinked to.

With any luck, I'll have a chance to try to get this working on my system this week, and then maybe I'll be more help.

-Chris

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

**********************************************************************
Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84043
801-768-2768 voice
801-768-2769 fax
**********************************************************************
"The greatest source of failure and unhappiness in the world is
giving up what we want most for what we want at the moment"
**********************************************************************