4.77778

4.8 | 9 ratings Rate this file 75 downloads (last 30 days) File Size: 26.15 KB File ID: #12962

Matfig2PGF

by Paul Wagenaars

 

11 Nov 2006 (Updated 22 May 2009)

Code covered by the BSD License  

Convert figures to PGF files that can be included in LaTeX documents.

Download Now | Watch this File

File Information
Description

Matfig2PGF is script that allows users to convert MATLAB figures to PGF <http://sourceforge.net/projects/pgf/&gt;. PGF figures can be included in a LaTeX document using the PGF macro package. The PGF package works with most important LaTeX backends (such as pdfTeX and Dvips). Using Matfig2PGF all text in the figure is typeset by LaTeX, so it blends in nicely with the rest of the document.

Features:
- 2D plots
- subplots
- histograms
- linear and logarithmic axes
- grids
- legends
- line styles and plot marks
- resulting pgf file can be used in LaTeX and pdfLaTeX

The current version is 0.3.9

Acknowledgements
This submission has inspired the following:
fig2texPS - Export Matlab Figure to LaTeX , matlab2tikz
MATLAB release MATLAB 7.5 (R2007b)
Zip File Content  
Other Files license.txt,
matfig2pgf.m,
matfig2pgf_gui_options.m,
matfig2pgf_menu.m,
matfig2pgf_options.m,
README,
useroptions.cfg.example
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (12)
10 Feb 2007 Shengshan Cui

I just want to see this work is awesome! It frees me from touching up Matlab figures or using Gnuplot to get high quality figures. In addition, with more and more LaTeX users using PGF, this work will be appreciated by more people.

Thanks for the excellent work!

10 Jun 2007 Dietrich Brunn

Excellent Tool - like it

28 Jun 2007 Martin Heller

Very nice tool!

It would be great if draw_patch could take CData into account if FaceColor=flat.

10 Sep 2007 mathan mathan

hai

04 Dec 2007 Mukhtar Ullah

Very useful. It would be very nice to have two more features: 1) latex allowed in the tick-labels. 2) multiple axes in the same figure.

26 Mar 2008 Peadar Grant

Very nice indeed - this must have taken a lot of work. I only wish I discovered this earlier.

26 Jun 2008 a s

Very nice contribution.

A few remarks, though:

* In the subfunction draw_patch, scaled indexed colouring is taken care of for edges, but not for faces. I had to add conversion to direct index to avoid errors.

* In some patch plots the axis grid should be visible above the patch object. As it is now, grid lines disappear.

* Does not recognize image objects and surface objects.

* My Matlab has started closing down without warning when I use this function. Might be a coincidence, though.

Will keep using this, it works brilliantly for ordinary line plots.

24 Dec 2008 Matt Fig

I like the name!

25 Dec 2008 Petter

I wish that it was possible to set the figure width from within the LaTeX document.

16 Feb 2009 Ian Washington

One of the best tools I've seen for figure conversion. I also would like to see an update to allow for figure width control from within latex, if it's not to difficult to implement. Capability for 3D plots would also improve this tool.

09 Jun 2009 Jason Wigg

A very, very nice contribution! Really wish I had found it earlier.

My only suggestion would be to implement something to check axes titles and legends to escape out LaTeX key characters. For example I have a plot with the title 'Voltage & Current against Time', which errors out when converted to pgf, as it needs to be 'Voltage \& Current against Time'.

08 Oct 2009 Juan Pablo

I'm running Matlab 7.5.0.338 (R2007b) on Debian (Lenny) and it just worked out of the box.

Please login to add a comment or rating.
Updates
13 Dec 2006

mod

02 Jan 2007

New version: Matfig2PGF 0.3

02 Jul 2007

Updated to version 0.3.1

13 Aug 2007

New version with bug fix

07 Dec 2007

New version with a few bugfixes

21 Jan 2008

New version (0.3.4)

31 Mar 2008

New version (0.3.5)

07 Jul 2008

There's an error in the file I uploaded about an hour ago. Please ignore that file and use this one.

11 Aug 2008

New version (0.3.7)

24 Dec 2008

New version with a couple of bug fixes.

22 May 2009

New version with a bug fix.

Tag Activity for this File
Tag Applied By Date/Time
graphics import Paul Wagenaars 22 Oct 2008 08:48:45
graphics export Paul Wagenaars 22 Oct 2008 08:48:45
latex Paul Wagenaars 22 Oct 2008 08:48:45
tex Paul Wagenaars 22 Oct 2008 08:48:45
export Paul Wagenaars 22 Oct 2008 08:48:45
convert Paul Wagenaars 22 Oct 2008 08:48:45
figures Paul Wagenaars 22 Oct 2008 08:48:45
pgf Paul Wagenaars 22 Oct 2008 08:48:45
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com