fig2texPS - Export Matlab Figure to LaTeX

Date:    03.11.2010
Author:  Peter Scholz
Email:   contact@peter-scholz.net
Version: 0.5.3

This MATLAB function converts a figure to a LaTeX file with PSTricks compatible macros. The packages pstricks, pst-node, pst-plot, pst-circ and moredefs are required. A minimal example latex code is generated at each time this script is run. The tex file can also be a stand-alone file so that the paper size matches the figure outline.

Contents

Motivation

The conversion tool has been written for the following reasons (compared to eps with psfrag):

Properties

The aim of this function is to create a tex-code picture of a Matlab figure in PSTricks syntax that can still be adapted after creation.

Supported Features:

Changes to Version 0.52 from 10.06.2010:

NOT Supported in this version:

The matlab code is based on the fig2tex file by Ercan Solak in 2005. The key modifications are that the ratios can be set, implementation of grids and logarithmic scale. The algorithm to reduce the number of large data sets is copied from Matfig2PGF by Paul Wagenaars in 2008. Bertrand Scherrer added the support of textboxes on 09.06.2010

Bugs and ToDo's

Syntax

fig2texPS()
fig2texPS(fignum)
fig2texPS(fignum,fname)
fig2texPS(fignum,globals)

Description

fig2texPS() exports either the activated figure (gcf) or a test function, if no figure is present.

fig2texPS(fignum) exports the figure with the number fignum.

fig2texPS(fignum,fname) exports the figure with the number fignum and sets its name to fname. The name can be changed in the Figure Export Properties later on.

fig2texPS(fignum,globals) exports the figure with the number fignum. The struct globals can be used in order to set different settings from outside this function. See the fieldnames for further explanation.

Figure Export Properties

The Figure Export Properties GUI is opened together with a replot of the figure for finetuning the export behavior. Each time a paramter is changed, the replot is updated automatically. The GUI can be used to set the following paramters:

Example file

The following example picture shows the functionality of the script: