Trying to save a figure using the savefig routine throws the following latex compilation error on my machine with MacTeX-2018 installed:
! LaTeX Error: Option clash for package graphicx.
Here is a minimal example that produces the failure.
import matplotlib as plt
with plt.style.context('science'):
plt.plot([1, 2, 3, 4], [1, 2, 3, 4])
plt.savefig('figure.eps', format='eps')
The compilation and subsequent saving work fine if the pgfplots packages is removed from the preamble directive in science.mplstyle.
I'm not sure how this change affects the figures.
Hi @qantik
Thanks for pointing that out. I didn't realize that the package would clash with EPS files.
I've now removed \usepackge{pgfplots} from science.mplstyle, and put it into its own style (pgf.mplstyle).
Trying to save a figure using the
savefig
routine throws the following latex compilation error on my machine withMacTeX-2018
installed:! LaTeX Error: Option clash for package graphicx.
Here is a minimal example that produces the failure.
The compilation and subsequent saving work fine if the
pgfplots
packages is removed from the preamble directive inscience.mplstyle
. I'm not sure how this change affects the figures.text.latex.preamble : \usepackage{amsmath}, \usepackage[T1]{fontenc}