Updated 4 May 2010
matlabfrag is a function which exports a Matlab figure to .eps and .tex files for use in LaTeX/pdfLaTeX/LyX. It is inspired by LaPrint, but is intended to be more WYSIWYG, by respecting figure handles better.
Some of the advantages of matlabfrag compared to LaPrint are:
- Much more emphasis on WYSIWYG.
- Handles figures that need the OpenGL or Z-Buffer renderers.
- Text objects are sized correctly (such as with a legend).
- Tick labels are handled better.
- Reduced number of options (which could also be viewed as a disadvantage).
- A great user manual ;-)
To include the figures in LaTeX, pdfLaTeX and LyX I recommend the pstool package. More information can be found in the User Guide.
Please email any bug reports to me (see my account for more details). I'm unlikely to notice any bug reports posted in the comments.
This is version 0.6.16 of matlabfrag, uploaded 04-Apr-2010.
- Fixed a bug that occurred when a figure wasn't frontmost.
Zebb Prime (2023). matlabfrag (https://www.mathworks.com/matlabcentral/fileexchange/21286-matlabfrag), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Inspired by: LaPrint
Inspired: Plot2LaTeX, matlabfrag to pdf, mat2fig - Conversion from a matrix to a figure
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Fixed a bug that occurred when a figure wasn't frontmost.
Documentation update: for plain LaTeX, \input should be used instead of \include.
Fixed a version checking bug which caused it to break in r2010a, and a EPS integer overflow bug.
Fixed a bug to do with blank strings, and a bug to do with baseline alignment.
Changed default painters dpi to 3200, and fixed my broken usage of inputParser.
Fixed a bug that occurred with [xyz]ticks set outside [xyz]lims.
- Added a test for empty ticks, while ticklabels are not empty.
- Removed AutoTick test from axis scalings, and updated the user guide to reflect this.
- Text alignment tweaks (hopefully for the better). In particular, x-tick labels should be vertically aligned better.
Fixed a bug that occurred if some (but not all) the tick labels are empty.
Fixed the horribly broken compatibility for r2007a and r2007b.
Improved alignment of negative xtick labels.
Improved tick label positioning.
Fixed some of the annoying resizing issues again.
Fixed support for rotated text when using the zbuffer and opengl renderers.
- Preliminary support for the opengl and zbuffer renderers.
- Fixed a bug that occurred when the figure being exported had no text in it.
- Better handling of axis tick labels and changed the substitution text format.