Save Graphs in MATLAB with Zoom & Scroll

  • MATLAB
  • Thread starter dpsguy
  • Start date
  • Tags
    Matlab
In summary, you can save a graph as a PDF by zooming in when you save it. However, if you want to save the graph with all its content, you have to open it again in MATLAB.
  • #1
dpsguy
69
0
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?
 
Physics news on Phys.org
  • #2
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

PRO-TIP: you can often open .ai (Adobe Illustrator) files using Adobe Reader.
 
  • #3
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.
 
  • #4
MATLABdude said:
PRO-TIP: you can often open .ai (Adobe Illustrator) files using Adobe Reader.


From http://noahlittle.wordpress.com/2007/12/10/open-adobe-illustrator-files-with-adobe-reader/
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...?
 
  • #5
MikeyW said:
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")?
 
  • #6
dpsguy said:
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 [itex]\LaTeX[/itex]:
http://asymptote.sourceforge.net/

EDIT: Both Inkscape and GIMP will allow you to open and work with .EPS files.
 
  • #7
dpsguy said:
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:
  • #8
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.
 

1. How can I save my graph in MATLAB?

To save a graph in MATLAB, you can use the saveas function. This function allows you to specify the type of file you want to save (e.g. PNG, JPEG, PDF) and the name of the file. You can also use the print function to save a graph in a specific format, such as EPS or SVG.

2. Can I save a graph with the zoom and scroll function enabled?

Yes, you can save a graph with the zoom and scroll function enabled. Simply use the zoom and pan functions to adjust the zoom and scroll settings, and then use the saveas or print function to save the graph.

3. How do I adjust the size of the saved graph?

You can adjust the size of the saved graph by specifying the width and height parameters in the saveas or print function. Alternatively, you can use the set(gcf,'Position',[x y w h]) function to set the figure size before saving the graph.

4. Can I save multiple plots in one figure?

Yes, you can save multiple plots in one figure by using the subplot function to create subplots within the figure. You can then use the saveas or print function to save the entire figure with all the subplots.

5. Is it possible to save a graph with a transparent background?

Yes, it is possible to save a graph with a transparent background. You can use the set(gca,'Color','none') function to make the axes background transparent, and then use the saveas or print function with the appropriate file type (e.g. PNG) to save the graph with a transparent background.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
Back
Top