altmany/export_fig for MATLAB Figure Export
A MATLAB toolbox for exporting publication quality figures
At a glance
- What is it?
- altmany/export_fig is a BSD-3-Clause MATLAB toolbox for exporting figures to image and document formats with controls for appearance, resolution, transparency, fonts and renderers. It suits MATLAB users preparing figures for publication, with partial support for uifigure and AppDesigner.
- Who is it for?
- Adopt export_fig when a MATLAB figure must closely match its on-screen appearance and the export needs publication controls such as resolution, transparency or font embedding. Do not treat it as a complete solution for uifigure or AppDesigner output, since the README documents only partial support.
- Can I use it commercially?
- Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 71 days ago.
- What is it written in?
- Mainly MATLAB, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 24, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What export_fig Solves for MATLAB Users
export_fig addresses a specific gap in MATLAB figure export. The README says that exporting a figure with functions such as `saveas` and `print` can unexpectedly change its size, axes limits, ticks and background colour. That is a problem for researchers, engineers and technical writers who need a plotted figure to remain recognizable after it moves from the MATLAB desktop into a paper, report, presentation or other document.
The toolbox has two stated goals. The first is to reproduce the appearance of a figure as displayed on screen. The second is to make the exported file suitable for publication through settings such as embedded fonts, image compression, lossless output, anti-aliasing, cropping, colourspace handling, alpha blending and resolution.
Its intended users are therefore MATLAB users whose export requirements go beyond simply writing an image. A plot that is adequate in a quick report may need a different pixel size, a transparent background or a particular line-rendering result when placed in a formal document. export_fig gives those users additional switches for those cases. The README does not present it as a general-purpose plotting package. Its scope is the transition from an existing MATLAB figure to an exported file.
How export_fig Builds the Exported Figure
The repository layout identifies `export_fig.m` as the main entry point. Supporting files include `print2array.m`, `print2eps.m`, `crop_borders.m`, `copyfig.m`, `eps2pdf.m`, `pdf2eps.m`, `pdftops.m` and `ghostscript.m`. This file structure is consistent with a toolbox that prepares a figure and performs format-specific conversion or post-processing rather than only passing a filename to one MATLAB export routine.
The README describes export_fig as retaining the appearance of the on-screen figure while applying options for output. For bitmap output, it can use the screen resolution by default, magnify the figure by a factor, set pixels per inch, or calculate a resolution that preserves the native pixel size of an image already displayed in the figure. The `-native` option is intended for that last case.
Renderer selection is another part of the mechanism. The README says dashed and dotted lines can appear shorter or disappear with the ZBuffer or OpenGL renderers, especially for thick lines or high resolution. The `-painters` option is presented as the alternative for those cases. The presence of conversion and output helper files also explains why export_fig supports more than a single image type. The exact internal sequence is not fully documented, so the README is the primary source for the supported options.
Resolution, Cropping and Line Rendering
export_fig provides three documented approaches to bitmap resolution. The `-m<val>` option magnifies the figure by a positive real number. In the README example, `-m2.5` produces an image larger than the on-screen figure. The `-r<val>` option specifies pixels per inch while keeping the figure dimensions in inches. The `-native` option is intended for figures that display an image at a size different from the image's original pixel dimensions.
The README states that resolution information is set correctly in PNG and TIFF files as if the output image had the dimensions of the on-screen figure. Cropping and anti-aliasing are enabled by default, although both can be disabled. This makes export_fig more than a simple filename wrapper. A caller can control the output canvas and rendering quality without first reconstructing the figure for a separate printing function.
The renderer remains a practical constraint. OpenGL is described as the default renderer for bitmaps. The README recommends painters when dotted or dashed lines lose their appearance. This choice can alter how lines and grid lines are represented, so it should be considered part of the figure design rather than an incidental export setting.
Installing export_fig and Running a First Export
The README does not document an installation command, a MATLAB package-manager invocation, a release download procedure or a repository-specific setup script. It identifies the repository as the source of the toolbox. The repository includes `Export_fig.prj` and the MATLAB files that make up the project, but the documentation does not state exactly how a user should add them to the MATLAB path. This article therefore does not invent an installation flag or package name.
The README gives a first example comparing `saveas` with `export_fig`. The code creates a plot, changes the figure position, writes one PNG with `saveas`, and writes another with export_fig:
plot(cos(linspace(0, 7, 1000)));
set(gcf, 'Position', [100 100 150 150]);
saveas(gcf, 'test.png');
export_fig test2.pngAccording to the README, the two files can differ in size and background colour. The `export_fig` output is intended to retain the on-screen figure's size and background colour. A reader should see both PNG files in the selected output directory.
If a solid background is required, the README shows changing the current figure before export:
set(gcf, 'Color', 'w');The extension supplies the output format in these examples. The README also documents PDF, EPS, JPEG and TIFF output, subject to the available MATLAB figure and export path.
Transparency and Publication-Oriented Formats
Figures that will be placed over coloured or textured document backgrounds may need transparency. export_fig provides the `-transparent` option, which the README associates with PDF, EPS and PNG output. The axes colour can be set separately before exporting. This separation lets a caller decide whether the figure background and axes background should both be transparent or whether only one layer should change.
For PNG output, the README also discusses alpha-blended semi-transparent patch objects. That is different from simply removing the figure background. It allows image content itself to retain partial transparency when the output is combined with another document background.
The toolbox also addresses publication quality. For lossy formats such as PDF, EPS and JPEG, the README says export_fig uses a high-quality setting with low compression by default. Lossless compression is listed among the quality concerns handled by the toolbox. Font embedding is another stated feature, which matters when the exported text needs to remain embedded in the resulting document.
These controls are useful when a figure must satisfy a publication or presentation workflow. They also create a dependency on correct option selection. A transparent PDF, a high-resolution PNG and a painter-rendered plot are different output choices, and the README does not imply that one command automatically makes every format appropriate for every document.
uifigure and AppDesigner Limitations
The clearest limitation is stated in the README: export_fig currently supports figures created with the `figure` function or GUIDE. Figures created with `uifigure` or AppDesigner have only partial support. The README links to issues #287 and #261 for details, but it does not provide a complete compatibility matrix or a documented workaround for every modern UI figure.
That boundary should affect adoption. A project containing app controls, UI axes or layout created through App Designer cannot be assumed to export exactly like a classic figure. The README does not say that callbacks, controls or app-specific visual properties are preserved. A user would need to inspect the output for each relevant figure type.
Another failure mode concerns line styles. A command may complete while still producing an unsuitable image if dotted or dashed lines lose their pattern. The README specifically describes this problem with ZBuffer and OpenGL, particularly for thick lines and high resolution, and presents painters as the alternative. Embedded images create a similar case: `-native` is useful when the image displayed in the figure must retain its original pixel size. These constraints are specific, but they make export_fig unsuitable as an unqualified replacement for every MATLAB export workflow.
Maintenance, Releases and the BSD-3-Clause Licence
The repository is not marked as archived. Its last push was on 2026-08-14, and the release history includes v3.58 on 2026-08-13, v3.57 on 2026-07-26 and v3.56 on 2026-07-22. Those repository facts show recent activity around the listed versions. The README does not provide a formal policy covering supported MATLAB releases, long-term compatibility or commercial support.
The repository identifies the project under the BSD-3-Clause licence. That licence permits use and modification under its terms, subject to the conditions in the repository's `LICENSE` file. Users who plan to redistribute the toolbox or include it in a larger distribution must review that file and preserve the required notices. This is a project-level fact, not a substitute for legal advice.
An upgrade also requires checking the repository files rather than assuming that older MATLAB syntax or export behaviour remains unchanged. The release names and dates are available, but the README excerpt does not describe a migration guide, breaking-change policy or automatic upgrade mechanism. The first verification step is therefore to compare the current MATLAB figure type and target format with the documented support.
export_fig Compared with MATLAB saveas and print
The main alternative named by the README is MATLAB's `saveas` and `print` functions. They are built into the MATLAB workflow and are simpler when a routine export is enough. The README contrasts them with export_fig because they can change visual properties such as figure size, axes limits, ticks and background colour.
export_fig takes a different approach by adding controls for visual fidelity, cropping, anti-aliasing, resolution, transparency, font embedding, alpha blending and renderer selection. For a figure that needs a fixed pixel scale or a transparent background, these controls are the reason to use the toolbox. The README's examples specifically show a visual comparison between `saveas` output and export_fig output.
The trade-off is scope. export_fig is MATLAB-specific and does not claim complete support for `uifigure` or AppDesigner. Built-in MATLAB export remains the direct choice for routine cases or when compatibility with the standard MATLAB path matters more than additional output controls. export_fig is more appropriate when the screen appearance and document-specific settings are central requirements, provided its documented figure-type and renderer limits fit the project.
Editorial conclusion
Adopt export_fig when a MATLAB figure must closely match its on-screen appearance and the export needs publication controls such as resolution, transparency or font embedding. Do not treat it as a complete solution for uifigure or AppDesigner output, since the README documents only partial support. Verify first that your target formats and renderer choices work with the figure types, images, transparency and line styles you use.
Frequently asked questions
What is export_fig used for in MATLAB?
export_fig is used to export MATLAB figures to standard image and document formats while trying to preserve the figure's on-screen appearance. The README also lists controls for resolution, transparency, cropping, anti-aliasing, compression and embedded fonts.
Does export_fig support uifigure and AppDesigner figures?
The README says support is only partial for figures created with `uifigure` or AppDesigner. It states that figures created with the `figure` function, or GUIDE, are supported.
How do I export a MATLAB figure at higher resolution with export_fig?
The README documents `-m<val>` for magnifying the figure, `-r<val>` for specifying pixels per inch and `-native` for preserving the native pixel size of a displayed image. Its example is `export_fig test.png -m2.5`.
Can export_fig make PNG and document backgrounds transparent?
The `-transparent` option is documented for PDF, EPS and PNG outputs. The README also describes alpha-blended semi-transparent patch objects in PNG output.
Which renderer should I use for dotted or dashed lines?
The README says dotted and dashed lines can lose their intended pattern with ZBuffer or OpenGL, especially with thick lines or high resolution. It presents `-painters` as the way to overcome this issue.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/altmany-export-fig)Was this useful?