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?


Actually, thanks to percusse's comment, I researched the pgfplots' externalize library and found that adding these two lines


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.


    Ma       Mb      a
    200      50      5.6
    170      80      3.3
    140      110     1.0
    100      150     -1.6
    70       180     -3.9

            title=Variable Net Force,
            ylabel={Net Force},
            legend entries={Raw Data,Line of Best Fit},
            legend style={at={(0.973,0.03)},anchor=south east},
                    [only marks, black] 
                    table[x=Ma, y=a]{\caseone};
                    [smooth, black, very thin]
                    table[x=Ma, y={create col/linear regression={y=a}}]

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.