image thumbnail

fig2texPS - Export Matlab Figure to LaTeX

version (299 KB) by Peter Scholz
V053 - Conversion of a Matlab figure to a LaTeX file with PSTricks compatible macros


Updated 03 Nov 2010

View License

The aim of this function is to create a tex-code picture of a Matlab figure in PSTricks syntax. The tex-file picture can still be adapted after creation and may be either a standalone tex-file or a file to be included in a larger document. The LaTeX packages pstricks, pst-node, pst-plot, pst-circ and moredefs are required. An minimal example latex code is generated at each time this script is run. The matlab code is based on the fig2tex file by Ercan Solak in 2005.

You can also download the latest version on

Supported Features:

* 2D plots with arbitrary number of lines and patches
* Linear and logarithmic axes and second y-axis
* Grids, subgrids, ticks and subticks
* Arbitrary colors, linestyles and markers
* Labels, title, legend and colorbar
* Annotations (TextArrows) are supported
* GUI, where the fontsize, the plotsize and the export file can be set
* Lines with many datapoints can be compressed in order to reduce file size and compilation time (copied from Matfig2PGF by Paul Wagenaars in 2008)
* Convergence Triangles can be shown for logarithmic plots
* Support of additional code in PSTricks syntax
* Standalone Option for creating high quality cropped pdf-files

Cite As

Peter Scholz (2022). fig2texPS - Export Matlab Figure to LaTeX (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: fig2tex, Matfig2PGF

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!