How to actually use export_fig?

How does the export_fig function work? I always get the hint to use the File Exchange and this function if I want to get high resolution pictures from my plots, but there is not a single word on how to actually use it. So everyone talks about it like you already know everything about it :( I am quite new to matlab. Do I just unzip it and copy all files in my directory of my script and then? Do I need to change something? Can someone help me with this or at least give me a link to a README that explains on how to use such functions? Thank you

3 Comments

Haha: This is so true ! Typical gadgets online...I got 2018b matlab and tried to run App Designer to plot the functions, which I have written already on version 2015b - impossible !! I will not start to re-write the program all over again...
seriously...for the light of the day I cannot find any instruction on how to save the plots (multiple plots) from my programs. I saved the figures using the save figure command in .bmp format and it worked fine, until I tried to open the file, then windows 10 said it cannot open the files. long story short, now i'm stucked with a bunch of more scripts with no instruction of how to run it...
I must said, there are plenty of people here are very helpful - thank you very much !!
App Designer is based on new graphics methods that did not exist in r2015b. The graphics it uses is based on web figures, so html and css and the like, with no use of java at all . Some of the old graphics properties do not exist or have to change form , so fundamentals such as figures and axes are different for App Designer . Older code requires adjustment for use with App Designer .
But you can continue to create gui with guide.
I find information that the default Windows 10 image viewer is not able to display aa number of different image types but that it is possible to switch back.

Sign in to comment.

 Accepted Answer

"Usage examples and tips can be found in the README section at: https://github.com/altmany/export_fig/blob/master/README.md"
To use it, go to the link in the file exchange and click on the Download link. Save the .zip file somewhere. Unzip the .zip into a separate directory in a convenient location. Then go into MATLAB and use the command
pathtool
and add the directory to the MATLAB path.
After that, you call it like any function that can be used in command or function mode.

5 Comments

Thanks a lot.
Thank a lot for very accurate answer Walter Robenson.
Thanks a lot.
To Walter Robenson: Thanks
I have one question: after all the path add-things are done, the MATLAB can run export_fig 123.png&fig&jpg.... But when it runs export_fig 123.pdf, it says: no ghostscript.m. But it is in the same file as the imported installation folder. What should I do?
Thank you in advance!
Sounds like you did not use pathtool to add the directory to your MATLAB path.

Sign in to comment.

More Answers (1)

James Richard
James Richard on 20 Oct 2019
Edited: James Richard on 20 Oct 2019
The organized ways I think is to use the built-in Add-On Explorer itself.
  1. In MATLAB, open Preferences
  2. Navigate to MATLAB>Add-Ons
  3. Choose any directory that you would like it. It's one directory for all add-ons.
  4. Click OK
  5. Now, open Add-On Explorer
  6. Search "export_fig", then open it
  7. Click "Add from GitHub"
  8. It will ask you to sign in first, if you haven't.
  9. Then click OK
Don't forget to install Ghostscript and pdftops (part of the Xpdf command line tools) if you haven't.
And you're done.
Locating Ghostscript/pdftops - You may find a dialogue box appears when using export_fig, asking you to locate either Ghostscript or pdftops (part of the Xpdf package). These are separate applications which export_fig requires to perform certain functions. If such a dialogue appears it is because export_fig can't find the application automatically. This is because you either haven't installed it, or it isn't in the normal place. Make sure you install the applications correctly first. They can be downloaded from the following places:
  1. Ghostscript: www.ghostscript.com
  2. pdftops (install the Xpdf package): www.xpdfreader.com
If you choose to install them in a non-default location then point export_fig to this location using the dialogue box.

Categories

Tags

Community Treasure Hunt

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

Start Hunting!