[Tex/LaTex] What do people use for modifying figures

graphicsMATLABpsfrag

I usually create figures for my articles in Matlab: various plots of numerical and analytical solutions. One thing that I don't like about it is that the font is different in the figure and in the resulting paper. Another thing is that it is a pain to put nicely typeset math into the figure directly.

My solution: psfrag.

psfrag allows text in a postscript file to be replaced by LaTeX so I would put a label AA (for example) where I want it in the figure, and then in LaTeX write \psfrag{AA}{$my formula$}.

This isn't such a great solution because it depends on psfrag (and journals do not like that), so I use fragmaster.pl which creates the modified pdf and eps files locally from the master file and an auxiliary file with the \psfrag commands…I then \includegraphics these generated files in my article.

This solution is a little roundabout, and so I'll repeat my question from the title:

What is your complete solution for generating nice figures using an external program (for example Matlab)?


Added Later:

After several answers were posted I noticed that none specifically addressed the issue of journals. Several times I've had editors come back to me saying something to the effect of "we'd like to publish your paper, please make sure that the figures you give us are in final form and no changes happen to them during typesetting"…

If would be so kind (and if you know the answer) please modify your answer to include information relating to how journals like your solution.

Best Answer

One solution is to export your graphics to a LaTeX-friendly format such as TikZ.

If you use MATLAB, there is a project that aims to export MATLAB figures to TikZ code:

http://github.com/nicki/matlab2tikz

If you are using R, I am the co-author of a graphics device that produces TikZ code- it is available on CRAN. Development releases may be downloaded from R-Forge and bleeding-edge source code can be found on GitHub.

Inkscape can be used along with a plugin that exports to TikZ for general graphics conversion tasks.

The advantage of exporting graphics to a format like TikZ is that there are no discontinuities in font usage or typesetting since LaTeX handles all the text. In the case of the R graphics device the user is also allowed to use the full range of LaTeX commands and packages to typeset arbitrary mathematical notation.

Response to Question Update

One nice thing about TikZ is that graphics can be externalized. This means that the code used to create the graphic is separated and used to compile a stand-alone figure. On subsequent runs the stand alone file is included as an image. Using this system you can leverage the full power of TikZ and then provide your document and a handful of static image files to the Journal minimal changes to your TeX source (basically flipping a switch on or off).

See Automagically externalising pdftricks and TikZ pictures and Script to automate externalizing tikz graphics.