# pgfplots figures in publications

Journals usually ask for the figures in a publication to be in some specific formats (e.g. eps, svg, tiff etc). Now that I have used pgfplots to make all the figures in my article, what is the best course of action to convert all of the figures to e.g. eps? Should I use some kind of an external tool to extract all the figures (gpdfx, inkscape etc) from the current article and the convert them to the correct format, and then use \includegraphics to include them again? A lot of tedious work, surely there is a better option?

• tex.stackexchange.com/q/8641 or tex.stackexchange.com/q/91275 or tex.stackexchange.com/q/140796 or tex.stackexchange.com/q/91472 (please let me know, if one of these works for you) Nov 10, 2014 at 13:27
• I'm sorry, but I believe none of them are very useful as I need to export all of the figures in one document into separate standalone files (pdf, eps or svg). Nov 10, 2014 at 18:11
• Don't use .eps for the final format but pgfplots and TikZ have a full-blown externalize library specifically designed for this purpose. Nov 11, 2014 at 8:19
• I think that your question is exact duplicate of those questions introduced you by @LaRiFaRi Nov 11, 2014 at 8:19

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}

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,]
[only marks, black]
table[x=Ma, y=a]{\caseone};

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.