Using Matplotlib, I generated a .pgf image.
import matplotlib
matplotlib.rcParams.update({"pgf.texsystem": "pdflatex"})
from matplotlib.pyplot import subplots, show
from numpy import linspace
x = linspace(0, 100, 30)
fig, ax = subplots(figsize = (10, 6))
ax.scatter(x, x)
fig.tight_layout()
fig.savefig('figure.pgf')
Which generates a long file: http://pastebin.com/tjLtTi5Q . I include this image in the document by using
\usepackage{pgf}
\input{testfig.pgf}
I would like to scale it in such a way that the font size remains the same. Preferably by wrapping something around the \input{...} rather than changing the pgf file, though the later is acceptable if that's the only way.
Previous attempts include:
\begin{pgfpicture}[scale=0.5]found here, but scale only exists fortikzpictureTrying to apply pgfmagnify, which I found here but can't get to work and can't find much documentation
\begin{pgfmagnify}{2}{2} \begin{pgfpicture} .... \end{pgfmagnify}Using
\begin{pgfpicture}[width=0.5]which also doesn't do anything.Using resizebox as mentioned here:
\resizebox{0.7\textwidth}{!}{\input{figure.pgf}}
which (perhaps obviously) does not preserve font size.
EDIT: picture using the suggestion in the comment by Harish Kumar:

Part of the file that seems related to fonts:
\pgftext[x=0.501680in,y=2.691389in,right,]{{\sffamily\fontsize{12.000000}{14.400000}\selectfont 40}}%

figsize = (10, 6)tofigsize = (5, 3)(or something like that) in your Python code? That way, the font size remains unchanged, but the overall size of the figure is reduced. – Jake Dec 06 '13 at 10:15matlab2tikzlibrary for instance generates PGFPlots code, which is much easier to adapt using styles within your LaTeX document, instead of generating low-level PGF code. In your situation, I would recommend exporting the data from Python and doing the plotting using entirely using "real" PGFPlots code, instead of exporting from Matplotlib. – Jake Dec 06 '13 at 10:26makefileyou can automate the process. Obtain the data from Python and use it inside the "real" PGFPlots code to generate the desired output. – Dror Dec 07 '13 at 20:27