0

My goal is to use the font and its size from the template (in my particular case the ieeetran.cls) for my plots.

With Python/Jupyter and matplotlib I create a plot which I store as pgf file, which works fine:

plt.rcParams.update({
    'font.family': 'sans-serif', # used for the plot in Jupyter
    'text.usetex': True, # used for the plot in Jupyter
    'pgf.rcfonts': False, # actually I thought this is the essential line
})
fig, ax = plt.subplots(figsize=(7.16, 3), dpi=300)
# do the plot
plt.savefig('../reports/plot.pgf')

But in the latex file, using

\input{figures/plot.pgf}

the fonts in the plot (especially the size) is not set correctly:

enter image description here

Please notice the different sizes for the caption and the legend or numbers.

I thought setting up 'pgf.rcfonts': False does the trick... What am I doing wrong?

Michael Dorner
  • 17,587
  • 13
  • 87
  • 117
  • Did you try the same figure with a different `cls` and see if the fonts are okay? Or perhaps with a simple [example](https://www.sbillaudelle.de/2015/02/23/seamlessly-embedding-matplotlib-output-into-latex.html)? I wonder if the font properties are from the document class itself. – SKPS Feb 10 '20 at 01:15
  • Yes, I did, the same problem occurred. I also linked the cls file (IEEEtran.cls). – Michael Dorner Feb 10 '20 at 11:52

0 Answers0