Description
Bug report
Bug summary
A pgf image exported by matplotlib leads to two different fonts in the x- and y-axis in a latex document
Code for reproduction
First you have to create the figure with the following code or a similar one.
import matplotlib as mpl
mpl.rcParams["axes.formatter.use_mathtext"] = False
import matplotlib.pyplot as plt
plt.close()
plt.semilogy(3.5, 3.5e3, "o")
plt.savefig("test.pdf")
plt.savefig("test.pgf")
Then you put the pgf
figure into a latex document:
\documentclass{scrartcl}
\usepackage{pgf}
\begin{document}
\input{test.pgf}
\end{document}
Actual outcome
Latex produces a pdf document with the y-axis in roman font (computer modern roman) and the x-axis in a sans-serif font (computer modern sans). I had expected both axes to have the same font.
The pdf produced by matplotlib in contrast has the sans-serif font for both axes.
Expected outcome
I would expected both axes to have a sans-serif font like in the pdf produced by matplotlib itself. However, I'm not sure if this is more latex related.
I also found a similar question on stackoverflow.
Matplotlib version
- Operating system: Ubuntu 18.04.2
- Matplotlib version: 3.1.0
- Matplotlib backend: TkAgg
- Python version: 3.6.8
- Jupyter version (if applicable): not important
- Other libraries: pdfTex 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian)