PDF problem?

I'm having troubles saving figures as PDF.
Matplotlib version 0.90.1
Simple example below.

Cheers,
Alan Isaac

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import pylab
fig = pylab.figure()
pylab.plot([1,2,3])

[<matplotlib.lines.Line2D instance at 0x016FF828>]

fig.savefig('c:/temp/temp.pdf')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 759, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line 188, in print_figu
re
    **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py", line 497, in print_figure

    printfunc(filename, dpi, facecolor, edgecolor, orientation, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 1395, in print_figur
e
    file.close()
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 401, in close
    self.writeFonts()
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 456, in writeFonts
    fontdictObject = self.embedTTF(filename)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 508, in embedTTF
    widths = [ get_char_width(charcode) for charcode in range(firstchar, lastchar+1) ]
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 505, in get_char_wid
th
    unicode = cp1252.decoding_map[charcode] or 0
AttributeError: 'module' object has no attribute 'decoding_map'

···

This is a problem using matplotlib 0.90.1 with Python 2.5.

See here:

http://sourceforge.net/tracker/index.php?func=detail&aid=1738494&group_id=80706&atid=560720

This patch applies cleanly against 0.90.1

Cheers,
Mike

Alan G Isaac wrote:

···

I'm having troubles saving figures as PDF.
Matplotlib version 0.90.1
Simple example below.

Cheers,
Alan Isaac

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import pylab
fig = pylab.figure()
pylab.plot([1,2,3])

[<matplotlib.lines.Line2D instance at 0x016FF828>]

fig.savefig('c:/temp/temp.pdf')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 759, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line 188, in print_figu
re
    **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py", line 497, in print_figure

    printfunc(filename, dpi, facecolor, edgecolor, orientation, **kwargs)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 1395, in print_figur
e
    file.close()
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 401, in close
    self.writeFonts()
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 456, in writeFonts
    fontdictObject = self.embedTTF(filename)
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 508, in embedTTF
    widths = [ get_char_width(charcode) for charcode in range(firstchar, lastchar+1) ]
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py", line 505, in get_char_wid
th
    unicode = cp1252.decoding_map[charcode] or 0
AttributeError: 'module' object has no attribute 'decoding_map'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Yes, that fixes it.

Perhaps I should mention that the PDF rendering is very slow.

Thanks!
Alan Isaac

···

On Mon, 08 Oct 2007, Michael Droettboom apparently wrote:

http://sourceforge.net/tracker/index.php?func=detail&aid=1738494&group_id=80706&atid=560720
This patch applies cleanly against 0.90.1

Alan G Isaac wrote:

···

On Mon, 08 Oct 2007, Michael Droettboom apparently wrote:

http://sourceforge.net/tracker/index.php?func=detail&aid=1738494&group_id=80706&atid=560720 This patch applies cleanly against 0.90.1

Yes, that fixes it.

Perhaps I should mention that the PDF rendering is very slow.

Yes, PDF is probably one of the slowest backends in matplotlib, mainly due to the inherent complexity of the file format, with all of its cross-references etc. If there are any particular things that are particularly bad, please send an example plot that exercises it.

Cheers,
Mike

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

I have noticed that scatter plots take a very long time to
render. (Use say four subplots each with three hundred points.)

Cheers,
Alan Isaac

···

On Mon, 08 Oct 2007, Michael Droettboom apparently wrote:

If there are any particular things that are particularly
bad, please send an example plot that exercises it.