pgfplots figures in publications
Actually, thanks to percusse's comment, I researched the pgfplots' externalize
library and found that adding these two lines
\usepgfplotslibrary{external}
\tikzexternalize
to my preamble did just what I wanted for no effort at all!
(Ryan's answer is also great, and thanks to him, but this is a better way.)
One possible workflow would be to drop each pgfplots
figure or tikzpicture
: into a standalone
document, which would give you a .pdf
file of just that figure, which you could then convert using something else.
\documentclass{standalone}
\usepackage{pgfplotstable}
\pgfplotstableread{
Ma Mb a
200 50 5.6
170 80 3.3
140 110 1.0
100 150 -1.6
70 180 -3.9
}\caseone
\begin{document}
\begin{tikzpicture}
\begin{axis}[
title=Variable Net Force,
xlabel={Acceleration},
ylabel={Net Force},
legend entries={Raw Data,Line of Best Fit},
legend style={at={(0.973,0.03)},anchor=south east},
width=\textwidth,]
\addplot
[only marks, black]
table[x=Ma, y=a]{\caseone};
\addplot
[smooth, black, very thin]
table[x=Ma, y={create col/linear regression={y=a}}]
{\caseone};
\end{axis}
\end{tikzpicture}
\end{document}
The above would output just the plot in pdf
format, which then can be converted to anything and including it with \includegraphics
would work fine because the whitespace is trimmed.
If you're on a unix-like system you could then use ImageMagick Convert to convert all the images at once, for example if you named all your figures figure1.pdf
figure2.pdf
figure3.pdf
then you could use convert -density 600 figure*.pdf figure*.eps
to batch-convert them all, preserving numbering.