version 3.28 (106 KB) by Yair Altman
Publication-quality export of Matlab figures and axes to various vector & bitmap formats


Updated 4 Dec 2022

From GitHub

View License on GitHub

Editor's Note: Popular File 2011 2012 2013 2014 2015 2016 2017 2018

This file was selected as MATLAB Central Pick of the Week

This function saves a figure or single axes to one or more vector and/or bitmap file formats, and/or outputs a rasterized version to the workspace, with the following features:
  • Figure/axes reproduced as it appears on screen
  • Cropped/padded borders (optional)
  • Embedded fonts (vector formats)
  • Improved line and grid line styles
  • Anti-aliased graphics (bitmap formats)
  • Render images at native resolution (optional for bitmap formats)
  • Transparent background supported (pdf, eps, png, tiff, gif)
  • Semi-transparent patch objects supported (png, tiff)
  • RGB, CMYK or grayscale output (CMYK only with pdf, eps, tiff)
  • Variable image compression, including lossless (pdf, eps, jpg)
  • Optional rounded line-caps (pdf, eps)
  • Optionally append to file (pdf, tiff, gif)
  • Vector formats: pdf, eps, emf, svg
  • Bitmap formats: png, tiff, jpg, bmp, gif, clipboard, export to workspace
This function is especially suited to exporting figures for use in publications and presentations, because of the high quality and portability of media produced.
Basic syntax: export_fig(filename, [handle], options...)
  • Background color and figure dimensions are reproduced (the latter approximately, and ignoring cropping & magnification) in the output file. For transparent background (and semi-transparent patch objects), use the -transparent option, and set the axes 'Color' property to 'none' where desired. Only some image formats support a transparent background, and only png/tiff support transparency of patch objects.
  • When exporting to vector format (pdf & eps), and to bitmap using the painters renderer, ghostscript (http://ghostscript.com) needs to be installed on your system
  • When exporting to eps, the pdftops program, a part of the Xpdf package, also needs to be installed. You can download this from http://xpdfreader.com
  • This submission was originally created by Oliver Woodford. Yair Altman maintains this utility since Jan 2015.
  • A single textual ad message is displayed once a week. I have no intention of removing the ad; if you don't want to see even a single ad once a week, don't use the program.
Report any problem or issue via GitHub: https://github.com/altmany/export_fig/issues - not here

Cite As

Yair Altman (2022). export_fig (https://github.com/altmany/export_fig/releases/tag/v3.28), GitHub. Retrieved .

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

Inspired: MakeMovie, DT QP Project, Constitutive model of shape memory alloys, surface2tikz(fighandle,filename,varargin), Spectral stochastic finite element method: 1D Euler-Bernoulli beam example, expandaxes, Crack Monitor, LaTeX Output Classes for MatLab, fig2img, copyUIAxes, ExportPngInkscape(filename,dpi,handle), Mosaicator, Antarctic flight planning tools, WITio, Online portfolio selection with transaction costs including market impact costs, imageslices, PM Architectures Project, Semismooth* Newton method for contact friction problems, Simulation of von Kármán viscoelastic plates, Tight subplot with units in centimeter, efigure, matlab-save-figure, polarG(start_complex,end_complex,arrow_length,arrow_angle,colour_code,line_width), Microscopy Image Browser (MIB), Microscopy Image Browser 2 (MIB2), alexludwigklein/MATLAB-Videos, Plot multiple surfaces multisurf(x,y,z,color), Matlab Icon for Linux (with Transparency), MAGIC - MATLAB Generic Imaging Component, append_pdfs, Google Earth Overlay, Multiple Colormaps, EPS Utility Toolbox, Export figure to 3D interactive PDF, Co-Blade: Software for Analysis and Design of Composite Blades, Color Checker Chart, Save figure to file, choose the dimensions and crop figure, jrichter24/toPPT, Simulation of Random Walk, Multiple Page PDF, JCDstatusPlot, XivelyRead, imsavecircles, PlotPub - Publication Quality Graphs in MATLAB, Laser, Filters and CMOS-Imager Calibration, Philips Hue Lamp Controller, HCPARULA: High Contrast Parula-like Colormap Generator, bibget, Export Figure Widget (efw), export_tex, Causal State Modeller Toolbox, Machine learning - balancing a stack of balls, Fast and efficient spectral clustering, latexfigure, FIGUREMAKER - Publication quality figures with matlab, TeloTool - Terminal Restriction Fragment Analysis

Community Treasure Hunt

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

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.