matlab2tikz supports the conversion of many MATLAB figures, including 3D plots. In particular, it supports a superset of plots compared to its ancestor matfig2pgf.
Among the supported features are:
* most axes properties (including logarithmic scaling),
* grids,
* line plots (including markers line styles),
* contour(f) plots,
* bar plots (stacked, grouped, histograms),
* stem plots,
* stairs plots,
* quiver (arrow) plots,
* colorbars,
* legends,
* images,
* subplots,
* zplane plots,
* frequency response plots,
* scatter plots,
* surf plots.
The workflow is as follows.
1. Place the matlab2tikz script in a directory where MATLAB can find it.
(the current directory, for example).
2. Generate your plot in MATLAB.
3. Invoke matlab2tikz by
>> matlab2tikz( 'myfile.tikz' );
The resulting file can be included into any LaTeX document (by \input{myfile.tikz}). Don't forget to add
\usepackage{tikz,pgfplots}
and optionally (as of Pgfplots 1.3)
\pgfplotsset{compat=newest}
\pgfplotsset{plot coordinates/math parser=false}
to the preamble of your LaTeX document.
To specify the dimension of the plot from within the LaTeX document, try
>> matlab2tikz( 'myfile.tikz', 'height', '\figureheight', 'width', '\figurewidth' );
and in the LaTeX source
\newlength\figureheight
\newlength\figurewidth
\setlength\figureheight{4cm}
\setlength\figurewidth{6cm}
\input{myfile.tikz}
If you would like to see more information, follow the development, submit a bug, or contribute in any other way, please visit matlab2tikz' web page at http://github.com/nicki/matlab2tikz .
There's also a matlab2tikz forum at http://win.ua.ac.be/~nschloe/forum/12/. |