Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: pass a figure as an argument to a function
Replies: 1   Last Post: Mar 27, 2012 6:56 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bjorn Gustavsson

Posts: 412
Registered: 12/7/04
Re: pass a figure as an argument to a function
Posted: Mar 27, 2012 6:56 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Yu " <yuzhaoshice@web.de> wrote in message <jks1go$cfr$1@newscl01ah.mathworks.com>...
> I need to save a plot as vector-graphic-based pdf-file. the following function serves the purpose to avoid big margins when saving pdf files. My question is, how to call this function withs a figure, e.g.
>
> figure(1)
> x = -pi:.1:pi;
> y = sin(x);
> plot(x,y)
>
> as the first argument.
>
> Here the function I stole somewhere from a blogg:
>
> saveTightFigure(h,outfilename)
> % SAVETIGHTFIGURE(H,OUTFILENAME) Saves figure H in file OUTFILENAME
>

[snip]
Call figure with an output:

Hfigure2save = figure(1);

then call saveTightFigure with that figure handle:
saveTightFigure(Hfigure2save,'varname.pdf')

HTH,



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.