Req: Matplotlib compatibility problem - help please!

Hi folks

I am teaching myself Python by working through Hans Petter Langtangen's excellent book "Primer on Scientific Programming in Python".

The exercises in chapter 4 of the book require the student to use Python with the freely downloadable tools MatplotLib and SciTools to plot graphs of mathematical functions.

Despite downloading and installing numerous different versions of Python 2.x, MatPlotLib and SciTools, I am unable to find a combination which will work together without crashing.

I'm currently using a Windows XP laptop with:
Python 2.6.6
IDLE 2.6.6
MatplotLib 0.99,3 win32 Py2.6
Scitools from scipy-0.80-win32-superpack-python 2.6

When I try to run a simple script to test the plotting functions, I get the error messages attached below.

I don't want to use Python 3, as there still seem to be some teething problems with this, and many of the modules that I've already written or need to use are not compatible with Python 3.x.

I've emailed the author, but have not yet had a reply.

I'd be very grateful if you could explain why I get the error messages shown below, what is a compatible combination of versions of Python 2.x, MatPlotLib and Scitools; and the URL of sites where I can download these.

Many thanks in anticipation

Dave
(UK)

···

=============================
Test script:

    1. from scitools.std import *
    2.
    3. def f(t):
    4. return t**2*exp(-t**2)
    5.
    6. t = linspace(0,3,51)
    7. y = zeros(len(t))
    8. for i in xrange(len(t)):
    9. y[i] = f(t[i])
   10.
   11. plot(t,y)
   12.
   13.

===============================

scitools.easyviz backend is matplotlib

Traceback (most recent call last):
File "C:\Python\Dave_Book Exercises\4_3_2 Plot test_DW.py", line 11, in <module>
plot(t,y)
File "C:\Python26\lib\site-packages\scitools\easyviz\common.py", line 3060, in plot
self._replot()
File "C:\Python26\lib\site-packages\scitools\easyviz\matplotlib_.py", line 906, in _replot
self._g.draw()
File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 352, in draw
get_current_fig_manager().canvas.draw()
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 215, in draw
FigureCanvasAgg.draw(self)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 314, in draw
self.figure.draw(self.renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 773, in draw
for a in self.axes: a.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1735, in draw
a.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 742, in draw
tick.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 196, in draw
self.label1.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 518, in draw
bbox, info = self._get_layout(renderer)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 280, in _get_layout
clean_line, self._fontproperties, ismath=ismath)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 148, in get_text_width_height_descent
texmanager = self.get_texmanager()
File "C:\Python26\lib\site-packages\matplotlib\backend_bases.py", line 374, in get_texmanager
from matplotlib.texmanager import TexManager
File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 72, in <module>
class TexManager:
File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 94, in TexManager
_dvipng_hack_alpha = dvipng_hack_alpha()
File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 68, in dvipng_hack_alpha
raise RuntimeError('Could not obtain dvipng version')
RuntimeError: Could not obtain dvipng version

Try the solution proposed at <http://groups.google.com/group/scitools/browse_thread/thread/b3ee1646bc453d72&gt;

Christoph

···

On 1/20/2011 2:42 PM, David Williams wrote:

Hi folks

I am teaching myself Python by working
through Hans Petter Langtangen's
excellent book "Primer on Scientific
Programming in Python".

The exercises in chapter 4 of the book
require the student to use Python with
the freely downloadable tools
MatplotLib and SciTools to plot graphs
of mathematical functions.

Despite downloading and installing
numerous different versions of Python
2.x, MatPlotLib and SciTools, I am
unable to find a combination which
will work together without crashing.

I'm currently using a Windows XP
laptop with:
Python 2.6.6
IDLE 2.6.6
MatplotLib 0.99,3 win32 Py2.6
Scitools from
scipy-0.80-win32-superpack-python 2.6

When I try to run a simple script to
test the plotting functions, I get the
error messages attached below.

I don't want to use Python 3, as there
still seem to be some teething
problems with this, and many of the
modules that I've already written or
need to use are not compatible with
Python 3.x.

I've emailed the author, but have not
yet had a reply.

I'd be very grateful if you could
explain why I get the error messages
shown below, what is a compatible
combination of versions of Python 2.x,
MatPlotLib and Scitools; and the URL
of sites where I can download these.

Many thanks in anticipation

Dave
(UK)

=============================
Test script:

     1. from scitools.std import *
     2.
     3. def f(t):
     4. return t**2*exp(-t**2)
     5.
     6. t = linspace(0,3,51)
     7. y = zeros(len(t))
     8. for i in xrange(len(t)):
     9. y[i] = f(t[i])
    10.
    11. plot(t,y)
    12.
    13.

===============================

scitools.easyviz backend is matplotlib

Traceback (most recent call last):
File "C:\Python\Dave_Book
Exercises\4_3_2 Plot test_DW.py", line
11, in<module>
plot(t,y)
File
"C:\Python26\lib\site-packages\scitools\easyviz\common.py",
line 3060, in plot
self._replot()
File
"C:\Python26\lib\site-packages\scitools\easyviz\matplotlib_.py",
line 906, in _replot
self._g.draw()
File
"C:\Python26\lib\site-packages\matplotlib\pyplot.py",
line 352, in draw
get_current_fig_manager().canvas.draw()
File
"C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py",
line 215, in draw
FigureCanvasAgg.draw(self)
File
"C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py",
line 314, in draw
self.figure.draw(self.renderer)
File
"C:\Python26\lib\site-packages\matplotlib\artist.py",
line 46, in draw_wrapper
draw(artist, renderer, *args,
**kwargs)
File
"C:\Python26\lib\site-packages\matplotlib\figure.py",
line 773, in draw
for a in self.axes: a.draw(renderer)
File
"C:\Python26\lib\site-packages\matplotlib\artist.py",
line 46, in draw_wrapper
draw(artist, renderer, *args,
**kwargs)
File
"C:\Python26\lib\site-packages\matplotlib\axes.py",
line 1735, in draw
a.draw(renderer)
File
"C:\Python26\lib\site-packages\matplotlib\artist.py",
line 46, in draw_wrapper
draw(artist, renderer, *args,
**kwargs)
File
"C:\Python26\lib\site-packages\matplotlib\axis.py",
line 742, in draw
tick.draw(renderer)
File
"C:\Python26\lib\site-packages\matplotlib\artist.py",
line 46, in draw_wrapper
draw(artist, renderer, *args,
**kwargs)
File
"C:\Python26\lib\site-packages\matplotlib\axis.py",
line 196, in draw
self.label1.draw(renderer)
File
"C:\Python26\lib\site-packages\matplotlib\text.py",
line 518, in draw
bbox, info =
self._get_layout(renderer)
File
"C:\Python26\lib\site-packages\matplotlib\text.py",
line 280, in _get_layout
clean_line, self._fontproperties,
ismath=ismath)
File
"C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py",
line 148, in
get_text_width_height_descent
texmanager = self.get_texmanager()
File
"C:\Python26\lib\site-packages\matplotlib\backend_bases.py",
line 374, in get_texmanager
from matplotlib.texmanager import
TexManager
File
"C:\Python26\lib\site-packages\matplotlib\texmanager.py",
line 72, in<module>
class TexManager:
File
"C:\Python26\lib\site-packages\matplotlib\texmanager.py",
line 94, in TexManager
_dvipng_hack_alpha =
dvipng_hack_alpha()
File
"C:\Python26\lib\site-packages\matplotlib\texmanager.py",
line 68, in dvipng_hack_alpha
raise RuntimeError('Could not obtain
dvipng version')
RuntimeError: Could not obtain dvipng
version

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options