As suggested by Phil, I'm reposting github issue #2067 on this list.

I use MPL 1.2.1 on Windows with Python 2.7.5. In my matplotlibrc I've
set sans-serif font to "Segoe UI".

Now, if I try to save a plot to PDF, MPL saves it fine, but if I try
PS or EPS or SVG it fails, because of the font set. (If I don't change
the font everything is fine)

Here is PDF info from mutool:
============================================================
PDF-1.4
Info object (27 0 R):
<<
  /CreationDate (D:20130528120149+02'00')
  /Producer (matplotlib pdf backend)
  /Creator (matplotlib 1.2.1, http://matplotlib.sf.net)
>>

Pages: 1

Retrieving info from pages 1-1...
Mediaboxes (1):
            1 (     10 0 R): [ 0 0 576 432 ]

Fonts (1):
            1 (     10 0 R): Type3 'SegoeUI' (14 0 R)
============================================================


So I wonder how can MPL output PDF, but can't output PS/EPS, let aside SVG?


And here is full trace from IPython:
================================================================================
KeyError                                  Traceback (most recent call last)
<ipython-input-63-6bec7f50eb05> in <module>()
----> 1 savefig('test.eps')

C:\Python27\lib\site-packages\matplotlib\pyplot.pyc in savefig(*args, **kwargs)
    470 def savefig(*args, **kwargs):
    471     fig = gcf()
--> 472     return fig.savefig(*args, **kwargs)
    473
    474 @docstring.copy_dedent(Figure.ginput)

C:\Python27\lib\site-packages\matplotlib\figure.pyc in savefig(self,
*args, **kwargs)
   1368             kwargs.setdefault('edgecolor',
rcParams['savefig.edgecolor'])
   1369
-> 1370         self.canvas.print_figure(*args, **kwargs)
   1371
   1372         if transparent:

C:\Python27\lib\site-packages\matplotlib\backend_bases.pyc in
print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
format, **kwargs)
   2094                 orientation=orientation,
   2095                 bbox_inches_restore=_bbox_inches_restore,
-> 2096                 **kwargs)
   2097         finally:
   2098             if bbox_inches and restore_bbox:

C:\Python27\lib\site-packages\matplotlib\backend_bases.pyc in
print_eps(self, *args, **kwargs)
   1841         from backends.backend_ps import FigureCanvasPS # lazy import
   1842         ps = self.switch_backends(FigureCanvasPS)
-> 1843         return ps.print_eps(*args, **kwargs)
   1844
   1845     def print_pdf(self, *args, **kwargs):

C:\Python27\lib\site-packages\matplotlib\backends\backend_ps.pyc in
print_eps(self, outfile, *args, **kwargs)
    972
    973     def print_eps(self, outfile, *args, **kwargs):
--> 974         return self._print_ps(outfile, 'eps', *args, **kwargs)
    975
    976

C:\Python27\lib\site-packages\matplotlib\backends\backend_ps.pyc in
_print_ps(self, outfile, format, *args, **kwargs)
   1005             self._print_figure(outfile, format, imagedpi,
facecolor, edgecolor,
   1006                                orientation, isLandscape, papertype,
-> 1007                                **kwargs)
   1008
   1009     def _print_figure(self, outfile, format, dpi=72,
facecolor='w', edgecolor='w',

C:\Python27\lib\site-packages\matplotlib\backends\backend_ps.pyc in
_print_figure(self, outfile, format, dpi, facecolor, edgecolor,
orientation, isLandscape, papertype, **kwargs)
   1098             bbox_inches_restore=_bbox_inches_restore)
   1099
-> 1100         self.figure.draw(renderer)
   1101
   1102         if dryrun: # return immediately if dryrun (tightbbox=True)

C:\Python27\lib\site-packages\matplotlib\artist.pyc in
draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56

C:\Python27\lib\site-packages\matplotlib\figure.pyc in draw(self, renderer)
   1004         dsu.sort(key=itemgetter(0))
   1005         for zorder, a, func, args in dsu:
-> 1006             func(*args)
   1007
   1008         renderer.close_group('figure')

C:\Python27\lib\site-packages\matplotlib\artist.pyc in
draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56

C:\Python27\lib\site-packages\matplotlib\axes.pyc in draw(self,
renderer, inframe)
   2084
   2085         for zorder, a in dsu:
-> 2086             a.draw(renderer)
   2087
   2088         renderer.close_group('axes')

C:\Python27\lib\site-packages\matplotlib\artist.pyc in
draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56

C:\Python27\lib\site-packages\matplotlib\axis.pyc in draw(self,
renderer, *args, **kwargs)
   1053
   1054         for tick in ticks_to_draw:
-> 1055             tick.draw(renderer)
   1056
   1057         # scale up the axis label box to also find the neighbors, not

C:\Python27\lib\site-packages\matplotlib\artist.pyc in
draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56

C:\Python27\lib\site-packages\matplotlib\axis.pyc in draw(self, renderer)
    238
    239         if self.label1On:
--> 240             self.label1.draw(renderer)
    241         if self.label2On:
    242             self.label2.draw(renderer)

C:\Python27\lib\site-packages\matplotlib\artist.pyc in
draw_wrapper(artist, renderer, *args, **kwargs)
     52     def draw_wrapper(artist, renderer, *args, **kwargs):
     53         before(artist, renderer)
---> 54         draw(artist, renderer, *args, **kwargs)
     55         after(artist, renderer)
     56

C:\Python27\lib\site-packages\matplotlib\text.pyc in draw(self, renderer)
    594                     renderer.draw_text(gc, x, y, clean_line,
    595                                        self._fontproperties, angle,
--> 596                                        ismath=ismath)
    597
    598         gc.restore()

C:\Python27\lib\site-packages\matplotlib\backends\backend_ps.pyc in
draw_text(self, gc, x, y, s, prop, angle, ismath)
    749
    750             self.set_color(*gc.get_rgb())
--> 751             self.set_font(font.get_sfnt()[(1,0,0,6)],
prop.get_size_in_points())
    752
    753             cmap = font.get_charmap()

KeyError: (1, 0, 0, 6)
================================================================================

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to