# Saving figures in Matlab

• MATLAB
I have created a graph in MATLAB using gplot. The graph has >2000 nodes, hence there is a lot of overlap between nodes and the picture is not very clear. This is not such a big problem in MATLAB as I can zoom into the figure. But I want to save the file as a PDF. When I do this, the image is saved as a “screenshot”, which does not support zoom as it does in MATLAB. Is there any way in which I can save this graph as a PDF, or even any other format like BMP in which I can scroll or zoom the figure?

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org
MATLABdude
I haven't done a whole lot of work exporting images from MATLAB, but the following page from the MATLAB documentation site may be of help (note that PDF is just a container, AI or EPS are usually vector format):
http://www.mathworks.com/help/techdoc/ref/saveas.html

To preserve detail in the figure you want to use a vector graphics file type, but even these files appear to only save what appears on your screen.

I experimented with .ai, .eps, and cannot open then in my reader. .png can be viewed, but does not store all the information.

The only way I know to store the image with all its content (including the ability to zoom) is as a .fig, which means you have to open it again in MATLAB. I'm sure there is a way to export it, but I don't know how.

Always check on “Create PDF Compatible FIle” when saving your “.ai” file for those you want to open in Reader later. If you don’t do this step, Ai will not embed the pdf data and Reader won’t see it either and give you an error.
Matlab does not give such an option, and I can't get the .ai file to open on Adobe reader.

But I suppose there must be some solution to my problem...?

To preserve detail in the figure you want to use a vector graphics file type, but even these files appear to only save what appears on your screen.

I experimented with .ai, .eps, and cannot open then in my reader. .png can be viewed, but does not store all the information.
Google docs now supports .eps format. But I tried it out and it does not seem to be any different from the pdf format, at least on Google docs. Is there any (free) software for "properly" opening .eps files (assuming that the eps format does store "all the information")?

MATLABdude
Google docs now supports .eps format. But I tried it out and it does not seem to be any different from the pdf format, at least on Google docs. Is there any (free) software for "properly" opening .eps files (assuming that the eps format does store "all the information")?
Inkscape is a great free and open source illustration / vector graphics program (it's the F/OSS analogue of Adobe Illustrator):
http://inkscape.org/

GIMP (the GNU Image Manipulation Program) is a great retouch / raster manipulation program (it's the F/OSS analogue of Adobe Photoshop):
http://www.gimp.org/

Both should be able to open .EPS files, but Inkscape is the one to use if you need to further manipulate images. For his thesis, a friend of mine avoided MATLAB altogether, and generated his plots in GNU Plot:
http://www.gnuplot.info/

I'll also plug something that a different friend of mine worked on: Asymptote, the vector graphics language. Very flexible if you're looking to plot equations rather than datapoints, and have some experience with $\LaTeX$:
http://asymptote.sourceforge.net/

EDIT: Both Inkscape and GIMP will allow you to open and work with .EPS files.

Google docs now supports .eps format. But I tried it out and it does not seem to be any different from the pdf format, at least on Google docs. Is there any (free) software for "properly" opening .eps files (assuming that the eps format does store "all the information")?
ghostscript/ghostview will open eps files. PDFCreator, which uses ghostscript, should be able to convert eps to pdf. You could also try to print directly from Matlab to PDFCreator (it creates a virtual printer) without saving to eps. I'm not sure if it would "print" in vector or bitmap format.

Both programs are open source and therefore free.

Last edited:
Thanks for the suggestions everyone!!

However I found my own solution to the problem- I created my network using Gephi (http://gephi.org/). Turned out to be pretty neat, though I still used Matlab to generate the .gdf files required for input.

Pity Matlab does not have a specialized toolbox for network visualization. Would have saved me a lot of hassle.