problem with savefig and PS files

Hi,
for some reason I have now (with the new matplotlib) problems with ps files saving figures with savefig.
(it works with gif, jpg, etc).

[I am running Python 2.3.4, IPython 0.6.12, matplotlib 0.82
and verbose.level helpful, interactive is False, platform is linux2, numerix numarray 1.3.0]

So here is what I get with a simple example:

scatter(arange(0,10,1), arange(10,20,1))
savefig('toto.ps')

···

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

/home/science/Sauron/AnalysisKin/Paper7/<console>

/usr/lib/python2.3/site-packages/matplotlib/pylab.py in savefig(*args, **kwargs)
    749 def savefig(*args, **kwargs):
    750 fig = gcf()
--> 751 return fig.savefig(*args, **kwargs)
    752 if Figure.savefig.__doc__ is not None:
    753 savefig.__doc__ = Figure.savefig.__doc__

/usr/lib/python2.3/site-packages/matplotlib/figure.py in savefig(self, *args, **kwargs)
    616 kwargs[key] = rcParams['savefig.%s'%key]
    617
--> 618 self.canvas.print_figure(*args, **kwargs)
    619
    620

/usr/lib/python2.3/site-packages/matplotlib/backends/backend_gtkagg.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation)
    114 try: agg.print_figure(filename, dpi, facecolor, edgecolor, orientation)
    115 except IOError, msg:
--> 116 error_msg_gtk('Failed to save\nError message: %s'%(msg,), self)
    117
    118 self.figure.set_canvas(self)

/usr/lib/python2.3/site-packages/matplotlib/backends/backend_agg.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation)
    458 svg.print_figure(filename, dpi, facecolor, edgecolor, orientation)
    459 elif ext.find('ps')>=0 or ext.find('ep')>=0:
--> 460 from backend_ps import FigureCanvasPS # lazy import
    461 ps = self.switch_backends(FigureCanvasPS)
    462 ps.print_figure(filename, dpi, facecolor, edgecolor, orientation)

ImportError: cannot import name FigureCanvasPS

ANY HELP welcome!!!
Thanks
Eric

--

Observatoire de Lyon emsellem@...419...
9 av. Charles-Andre tel: +33 4 78 86 83 84
69561 Saint-Genis Laval Cedex fax: +33 4 78 86 83 86
France http://www-obs.univ-lyon1.fr/eric.emsellem

Hi Eric,

···

On Tuesday 21 June 2005 11:16 am, Eric Emsellem wrote:

for some reason I have now (with the new matplotlib) problems with ps
files saving figures with savefig.
(it works with gif, jpg, etc).

[I am running Python 2.3.4, IPython 0.6.12, matplotlib 0.82
and verbose.level helpful, interactive is False, platform is linux2,
numerix numarray 1.3.0]

So here is what I get with a simple example:

scatter(arange(0,10,1), arange(10,20,1))
savefig('toto.ps')

I didnt have any trouble with this example. Your traceback shows backend_agg
cant import FigureCanvasPS. Does this work in ipython?

from matplotlib.backends.backend_ps import FigureCanvasPS

Did you try to removing the matplotlib directory in site-packages, and
reinstalling?

--
Darren S. Dale

Bard Hall
Department of Materials Science and Engineering
Cornell University
Ithaca, NY. 14850

dd55@...163...
http://people.ccmr.cornell.edu/~dd55/

Thanks for the tip, but as you and John suggested I tried a new clean installation (both for matplotlib - removing the site-packages and /usr/share matplotlib dir - and ipython) but the small test I sent you still react the same. The specific import command:

from matplotlib.backends.backend_ps import FigureCanvasPS

does indeed give an ImportError:

ImportError: cannot import name FigureCanvasPS

not sure what to do now. Thanks for any input there!

Eric

Darren Dale wrote:

···

Hi Eric,

On Tuesday 21 June 2005 11:16 am, Eric Emsellem wrote:

for some reason I have now (with the new matplotlib) problems with ps
files saving figures with savefig.
(it works with gif, jpg, etc).

[I am running Python 2.3.4, IPython 0.6.12, matplotlib 0.82
and verbose.level helpful, interactive is False, platform is linux2,
numerix numarray 1.3.0]

So here is what I get with a simple example:

scatter(arange(0,10,1), arange(10,20,1))
savefig('toto.ps')
   
I didnt have any trouble with this example. Your traceback shows backend_agg cant import FigureCanvasPS. Does this work in ipython?

from matplotlib.backends.backend_ps import FigureCanvasPS

Did you try to removing the matplotlib directory in site-packages, and reinstalling?

--

Observatoire de Lyon emsellem@...419...
9 av. Charles-Andre tel: +33 4 78 86 83 84
69561 Saint-Genis Laval Cedex fax: +33 4 78 86 83 86
France http://www-obs.univ-lyon1.fr/eric.emsellem