I am generating pgfplot files (PGF) with Python and matplotlib.pyplot as well as the following configuration for pgf export to be used with pdfLatex compiler:
import matplotlib as mpl
mpl.use("pgf")
pgf_with_pdflatex = {
"pgf.texsystem": "pdflatex",
"pgf.preamble": [
r"\usepackage[utf8x]{inputenc}",
r"\usepackage[T1]{fontenc}",
#r"\usepackage{cmbright}",
]
}
Using the comon plt.plot() commands and so on into Python, I manage to generate a 20cm wide plot and then export it into a pgf file using the plt.savefig('Graphes/pompage_pCav.pgf', format = 'pgf') Pyplot command.
That pgf file seems pretty proper. I then include it into a tex file as a figure:
\begin{figure}
\begin{center}
\input{Figures/pompage_pCav.pgf}
\end{center}
\caption{test}
\label{test}
\end{figure}
The page size is A4 (so 21cm wide) and here is the result:

As you can see, the figure isn't centered whether I use the center latex environment or the \centering command. How to solve this issue?
Thanks.
\textwidth, that will cause a shift in the fashion of your image. If this is the case, there are several options, the simplest being to shrink your figure down to a width of\textwidth. – Steven B. Segletes Apr 25 '18 at 14:24\centeringinstead of thecenterenvironment, to avoid additional vertical spaces. – samcarter_is_at_topanswers.xyz Apr 25 '18 at 15:03