Objective:
produce multi-page pdfs using xelatex so I can have advanced latex and stix 
fonts (using xits package)

I've used pdf multipage with the recipe:

import matplotlib as mpl
mpl.use ('pdf')
import matplotlib.pyplot as plt

from matplotlib.backends.backend_pdf import PdfPages
pdf = PdfPages('test_uw3.pdf')
for page in ...
    fig = plt.figure() 
    pdf.savefig (fig)
    plt.close()
pdf.close()

Now I'm interested in using xelatex (to use stix fonts).  So I saw the 
I should use pgf

If I add:

from matplotlib.backends.backend_pgf import FigureCanvasPgf
matplotlib.backend_bases.register_backend('pdf', FigureCanvasPgf)

as suggested by
http://matplotlib.org/users/pgf.html

I get an error:
Traceback (most recent call last):
  File "./read_hist3.py", line 121, in <module>
    pdf.savefig (fig)
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.py", 
line 2258, in savefig
    figure.savefig(self, format='pdf', **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1363, in 
savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 
2093, in print_figure
    **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 
1943, in _print_method
    return print_method(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py", 
line 830, in print_pdf
    raise ValueError("filename must be a path or a file-like object")
ValueError: filename must be a path or a file-like object

Any ideas?


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to