File Exchange

image thumbnail

SDF - Set the Figure

version (1.97 KB) by Andrey Popov
Set the line width and fonts of a figure, as if using the File->Export setup in the figure menu


Updated 23 Jul 2009

View Version History

View License

The function is aimed at fast setting the figure fonts and line sizes to a comfortable viewing and exporting and is best suited to plots whose result is difficult to adjust (for example the step, impulse and bode plots of the control toolbox, to name a few).
The function is useful during lectures or tutorials when the figure size has to be easily adjusted for better viewing.
The name of the function is partially chosen so, that it can be promptly typed on QWERTY keyboard (where "s", "d" and "f" are adjacent letters).
The function help follows:

SDF Set the line width and fonts of a figure


where fig is the figure number. If the figure number is omitted, the currently active figure is updated. Edit the file to set you own style settings.

sdf(fig, 'stylename')
applies a pre-configured style from the File-->Export Setup menu of the figure's window. The stylename should be one of the 'Export Styles' section of the dialog.

The function allows applying the same settings as through the File-->Export Setup-->Apply menu of the figure, but much faster and without the annoying clicking.

figure(1); t=0:0.1:10; plot(t, sin(t));

Cite As

Andrey Popov (2021). SDF - Set the Figure (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (16)

Afshin Aghayan

Othman Younus

Amazing function. Thank you

Akash Mankar

Saving a lot of time, Thanks


Somehow very slow after the style is applied. It is exporting some dummy image and takes a long time for high resolution images.

Monika Kreitmair


Jan Scheuermann





Simple to use and efficient. Thank you!


This is cool and what I need!

Hung Dinh

Peter Cendula

exactly what I was looking for!
Just one Q: the dimension of figure from SDF with 'PowerPoint' is 876x656, but the one I got when actually clicking File-->Export Setup-> Load Style ->PowerPoint is only 561x420, why is this? Both pictures have similar dimension when imported in PowerPoint, so there's another resolution for them?


well done...
now, the next step to get the 5th star:

1) add an output arg, which returns the current STYLE struct...
2) now, a user can change fields to his/her liking - and save it...
3) allow the user to enter his/her (modified) struct...
if isstruct(varargin{1})

all done in a split...
and a big enhancement to an already nice function...

Andrey Popov

Thanks for the idea. Already implemented.


it would be nice, if a user could also input the name of his/her style sheet:
add this to the engine

function sdf(fig,snam)
if nargin == 1
% your code
% note: REMOVE extension, which is .txt by def
% ...apply style sheet info

just a thought...

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: Save figures Shortcut

Community Treasure Hunt

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

Start Hunting!