Code covered by the BSD License  

Highlights from
SDF - Set the Figure

4.66667

4.7 | 3 ratings Rate this file 6 Downloads (last 30 days) File Size: 1.97 KB File ID: #24807
image thumbnail

SDF - Set the Figure

by Andrey Popov

 

21 Jul 2009 (Updated 23 Jul 2009)

Set the line width and fonts of a figure, as if using the File->Export setup in the figure menu

| Watch this File

File Information
Description

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

sdf(fig)

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.

Example
  figure(1); t=0:0.1:10; plot(t, sin(t));
  sdf(1)
  pause
  sdf(1,'PowerPoint')

MATLAB release MATLAB 7.2 (R2006a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
22 Jul 2009 us

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
else
% note: REMOVE extension, which is .txt by def
s=hgexport('readstyle',snam);
% ...apply style sheet info
hgexport(fig,fnam,s);
end

just a thought...
us

23 Jul 2009 Andrey Popov

@us
Thanks for the idea. Already implemented.

26 Jul 2009 us

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...
   eg,
          if isstruct(varargin{1})
          style=varargin{1};
          %...
          end

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

30 Jul 2009 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?

09 Oct 2009 Hung Dinh  
Please login to add a comment or rating.
Updates
23 Jul 2009

Added possibility to use a pre-recorded Style

Tag Activity for this File
Tag Applied By Date/Time
figure Andrey Popov 21 Jul 2009 11:36:56
export Andrey Popov 21 Jul 2009 11:36:56
plot Andrey Popov 21 Jul 2009 11:36:56
font size Andrey Popov 21 Jul 2009 11:36:56
line width Andrey Popov 21 Jul 2009 11:36:56
font size Daniel O'Brien 31 Oct 2010 08:45:00
plot Jose Ercolino 03 May 2011 23:22:03
export Jose Ercolino 03 May 2011 23:22:23
figure Jose Ercolino 03 May 2011 23:22:25
graphics Jose Ercolino 03 May 2011 23:22:45

Contact us at files@mathworks.com