This shows you the differences between two versions of the page.
— | linux:matplotlib_pgf_backend [2016/12/22 10:39] (current) – created jansen | ||
---|---|---|---|
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:// | ||
+ | |||
+ | 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(' | ||
+ | |||
+ | If you need customization of the fonts, that may have to be done through the pgf settings; the page linked above has some examples. | ||