User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

linux:matplotlib_pgf_backend [2016/12/22 10:39] (current)
jansen created
Line 1: Line 1:
 +====== Creating PDF files from Matplotlib using the PGF backend ======
 +Since matplotlib in Fedora 25 seems to be having some font issues when using latex fonts and creating pdf or ps files, a workaround is needed. Luckily, PDF files can also be created using the PGF backend. See [[http://​​users/​pgf.html]] for details
 +Basically, include these lines in the python script and saving to pdf will work:
 +  from matplotlib.backends.backend_pgf import FigureCanvasPgf
 +  from matplotlib.backend_bases import register_backend
 +  register_backend('​pdf',​ FigureCanvasPgf)
 +If you need customization of the fonts, that may have to be done through the pgf settings; the page linked above has some examples.
linux/matplotlib_pgf_backend.txt ยท Last modified: 2016/12/22 10:39 by jansen