Which way of exporting Matlab graphics delivers the best result for inclusion in LaTeX? Is it possible to export scalable vector graphics, or even LaTeX graphics?
|
In case the kind of graphics you wish to export is supported by You get true vector graphics in TikZ, i.e., no fiddling with PostScript, being restricted to |
||||
|
|
Here I will show two examples where using
For these situations: either you have a large dataset like a complicated triangulation/flow fields, or you have options such as
There is a large thread of How to include SVG diagrams in LaTeX? on TeX.SE, the step 2 is what is in the accepted answer, if you are using Linux, once you installed Inkscape, you could use these shell scripts to convert svg to pdf/eps/png file formats.(Beware: the sh in the link is using zsh shell) Other advantages of using this approach to export
|
|||||
|
|
The The |
||||
|
|
There are two Matlab packages for exporting graphs to EPS plus psfrag, which replaces the labels inside the figures with strings that are typeset by LaTeX. They are laprint and matlabfrag; I recommend the latter as it will work for more graphic types, and laprint is no longer supported. The support for surface-plot output may well make this a better option than the tikz based converters, otherwise the quality will be largely the same. To include these types of graphics into pdfLaTeX, use the pstool package. |
|||
|
|
|
There is a great library called pgfplots, which creates great looking plots directly in latex. This package is used by matlab2tikz. You can write the data you want to plot in an ascii table, and create legends, axis labels and such directly in latex, very much like the code you would have written in Matlab anyway. You can easily change the contents, colors (for example for B/W prints), width and heigh, resolution, and much more without having to recreate figures. |
|||
|
|
|
In MATLAB all labels and titles, you can use LaTeX interpreter to make your plot more professional.
Then the best way to include MATLAB plots into your latex document you have to follow these steps
You should not save picture in pdf format since the bounding box will be not correct. |
|||||||
|
|
If you want to have scalable results, the better way is maybe to use the vectorial format eps (encapsulated postscript) but you will have to compile with "classic" latex and not pdflatex. I am pretty sure that matlab is able to generate eps. |
|||||||
|
|
you may also have a look at the export in pstricks : fig2tex together with the provided links. |
|||
|
|
|
The easiest way is to use export_fig that convert Matlab figures to PDF automatically with some nice and useful features. For both advanced and enthusiastic Matlab users, the possible way is to run through 11 pages of recommendations in "How To Make Pretty Figures With Matlab" manual. |
|||
|


