Publication-quality export of Matlab figures and axes to various vector & bitmap formats

ダウンロード: 331.6K

更新 2023/1/3

GitHub から

GitHub でライセンスを表示

編集メモ: 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


Yair Altman (2023). export_fig (https://github.com/altmany/export_fig/releases/tag/v3.29), GitHub. 取得済み .

MATLAB リリースの互換性
作成: R2014b
Windows macOS Linux

ヒントを与えたファイル: 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!

GitHub の既定のブランチを使用するバージョンはダウンロードできません

バージョン 公開済み リリース ノート

See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.29


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.28


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.27


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.26


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.25


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.24


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.23


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.22


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.21


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.20


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.19


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.18


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.17


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.16


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.15


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.14


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.13


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.12


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.11


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.10


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.09


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.07


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.06


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.05


See release notes for this release on GitHub: https://github.com/altmany/export_fig/releases/tag/v3.04

new version

Added -update option to download and install the latest version of export_fig

Added the -clipboard input arg for optional clipboard output (credit: Jiro Doke's imclipboard function)

Added link to technical description webpage

Several fixes; more informative error messages; improved functionality

Passed maintenance responsibility over to Yair Altman

Support for R2014b (actually added some time ago, but the FEX update date didn't reflect this)

Update description

Added support for HG2

Replace acknowledgements

Switch to GitHub repository

Fix bug in isolate axes; thanks to Remington Reid for bringing the issue to my attention.

Allow setting of resolution for vector formats (thanks to Jan Jaap Meijer for suggesting this). Fix bug in isolate_axes (thanks to Will Grant for this).

Fixed a font swapping bug and a MATLAB bug affecting the export of white lines to EPS. Thanks to George and Sebastian for reporting the issues.

Fixed a font swapping bug and a MATLAB bug affecting the export of white lines to EPS. Thanks to George and Sebastian for reporting the issues.

Fixed bug with calling ghoscript 9.07 in Linux. Many thanks to Jannik for the fix.

Access user strings in text, not binary mode, to avoid errors. Now swap fonts in axes labels when exporting in vector format. Thanks to Christian and Rasmus Ischebeck for pointing out these respective errors.

Allow export of uipanel objects, and improve finding Ghostscript on Windows. Thanks to michael and Ratish Punnoose for highlighting these issues.

Bug fix to font swapping in vector formats, fixed paper orientation bug and removed conflict with the path function. Many thanks to Malcolm Hudson, Michael Watts and Michel Slivitzky for reporting those issues respectively.

Fix to bug introduced by R2012b

Add ability to add bookmarks based on figure names into PDFs - thanks to Petr Nechaev for this. Keep tick marks fixed - thanks to Arcelia Arrieta for this.

Make font swapping case insensitive. Fix bug affecting export to bitmap using painters in r2012a (thanks to Andy Matthews for reporting it).

Fixed a bug to do with copyfig not being available to export_fig. Thanks to Bob Fratantonio for pointing it out.

A bug fix to the previous change, ensuring that axes limits are correctly set. Thanks to Tobias Lamour for reporting the issue.

Ensure axes limits are the same on screen and printed.

Fix bug when exporting tall figures to bitmap using the painters renderer. Thanks to Ken Campbell for reporting it.

Improve font swapping behaviour. Thanks to Anna Rafferty and Adam Jackson for reporting issues.

Fix bug affecting export using -painters with spaces in font names. Thanks to David Szwer for reporting the issue.

More reliable export of non-standard fonts using painters renderer.

Allow use of arbitrary fonts with the painters renderer, e.g. in eps and pdf files.

Various bug fixes - thanks to Phil Trinh, Mathieu Morlighem and Meelis Lootus for reporting the issues. Also added new -transparent option, and set default anti-aliasing down to -a3.

Fix to bug in print2array causing an error when exporting using painters with a white background. Thanks to Tobiar Lamour for reporting it.

Fix bitmap cropping with painters renderer. Make bitmap outputs exactly the right size. Suppress warnings by setting EraseModes to normal when using opengl or zbuffer renderers (thanks to Pawel Kocieniewski for reporting the issue).

Bug fix to ghostscript.m mostly affecting Linux (thanks to Paul Durack for reporting it).

Find 64-bit Ghostscript on Windows (thanks to Paul Durack and Shaun Kline for both reporting this issue). Fix bug in isolate_axes (thanks to Rosella Blatt for reproting this).

Save user specific paths in a single, hidden directory. Put isolate_axes code in a separate function.

Enable exporting of multiple axes (when a subset of all axes). Don't save user specific paths in .m files that may be version controlled (thanks to Jonas Dorn for the suggestion). Minor bug fixes.

Faster bitmap export using hardcopy. Better error checking for when exporting to non-existent directories (thanks to Aldebaro Klautau for reporting this).

Isolate axes better in presence of gui objects (thanks to Tammy Threadgill for reporting the issue). Maintain resolution of very small images in vector formats when using lossless compression (thanks to Scott for reporting the issue).

Added ability to append to tiff. Added link to usage examples web page (thanks to Brett Shoelson for the suggestion).

Fixed bug which caused bitmaps to be poorly rendered when using the painters renderer on figures with many patches in. Also added fix to bug reported by Andrew Matthews (thanks!) affecting export in -nodisplay mode.

Fix to bug which caused an error when exporting to transparent bitmap with no colorbar present (introduced 8th April 2010). Thanks to Gracee for reporting it.

Fix for R2006b (possibly even R2007a) and earlier: move embedded fonts after bounding box information. Thanks to Sylvain Fa for reporting the problem.

Fix to colorbar axes color bug with transparent bitmap export (thanks to Roland Martin for reporting it). Look for ghostcript in default location on 64 bit Windows (thanks to suggestion by Nathan Childress).

Added ability to vary quality/compression level for jpg, pdf & eps output. Thank you to Fabio Viola for pointing out compression artifacts using the default settings.

Improved accuracy of native resolution feature in some circumstances.

Added -native option for exporting to bitmap at native resolution of an image. Fixed uigetdir title problem on MAC OS X (thanks to Jonas for the bug report).

Improved rendering of dashed and dotted lines for bitmap outputs using the -painters algorithm. This overcomes the "shrinking dash" problem mentioned by Yvonne Haesevoets (thanks!).

No change to the file, just a correction - I thank Paul Soderlind for suggesting the grayscale output option, not Bob Sica (apologies to you both).

Bug fix (thanks, Andreas Offenhaeuser). Added grayscale option (suggestion thanks to Bob Sica). Added correct resolution for tiff & png (sugestion thanks to Yvonne Haesevoets).

Fixed bug that meant -tif lead to jpeg being output instead.

Appending to end of pdf files is now off by default, and enabled by the -append option. Suggested by Clark Richards.

Added ability to export at any resolution (bitmap outputs only) and also in CMYK colorspace (tiff, pdf, eps only).

Added option to use zbuffer renderer for bitmaps. This avoids some errors caused by bugs in the opengl renderer.
Fixed bug when exporting greyscale figures with an alphamatte (thanks to Annette for pointing it out).

Added options to disable cropping and set level of anti-aliasing. Added a fix to get round a rendering bug in print (thanks to Johannes Korsawe for pointing it out).

Export colorbars associated with subplots when in a uipanel. Thanks to Johannes Korsawe for pointing out the bug.

Fixed bug to allow exporting of axes that are children of uipanels. Thanks to Stefan for pointing out the bug.

Added ability to compute transparency of patch objects when outputting to png and exporting to workspace.

Incorporated Christian Dorion's patch for updating ghostscript (and also pdftops) path. Fixed bug that didn't correctly detect if pdftops path was valid (due to a MATLAB/Windows bug).

Added ability to append to pdf files, as suggested by Matt C. Corrected some help text.

Added ability to export rasterized figure straight to the workspace.

この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。
この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。