Saving Plots to Disk: saveplot.m Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search


Saving Plots to Disk: saveplot.m

Figure H.5: Compatibility matlab function for saving a plot to disk--Octave version.

 
function saveplot(filename,optargs)
% SAVEPLOT - Save current plot to disk in a PostScript file.
%            This version is compatible only with Octave.
%            In Matlab, just say 'print -deps[c] filename'.
%            *** MULTIPLOT MODE NOT SUPPORTED ***
%            (only get last plot)

if (nargin<2), optargs = ''; end;
% optargs to consider: 
%   landscape 
%   color 
%   solid 
%   "<fontname>" <fontsize> 
%   lw <width> [default = 1.0]

gset terminal push

gset nomultiplot % can't set out terminal in multiplot mode
%gset terminal fig % in this output format, you can edit it!
cmd=['gset terminal postscript eps monochrome enhanced',...
     optargs]; 
eval(cmd);

disp(sprintf('Writing current plot to %s',filename));
cmd = sprintf('gset output \'%s\';',filename); eval(cmd);

replot
% remultiplot -- does not yet exist in gnuplot
closeplot

gset terminal pop

Figure H.6: Compatibility matlab function for saving a plot to disk--Matlab version.

 
function saveplot(filename)
% SAVEPLOT - Save current plot to disk in a PostScript file.
%            This version is compatible only with Matlab.

cmd = ['print -deps ',filename]; % for color, use '-depsc'
disp(cmd); eval(cmd);


Next  |  Prev  |  Up  |  Top  |  Index  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

[How to cite this work] [Order a printed hardcopy]

``Introduction to Digital Filters with Audio Applications'', by Julius O. Smith III, (August 2006 Edition).
Copyright © 2007-02-02 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA  [Automatic-links disclaimer]