# HG changeset patch # User Rik # Date 1289868763 28800 # Node ID 31f8534eb055b8cd689a856b43fe82e83228b0b0 # Parent 093c9facf0f0f56c20d6170759f13cda81f8d3b7 Add reference to new saveas function in printed manual. Change saveas.m to more closely follow Octave coding standards. diff --git a/doc/ChangeLog b/doc/ChangeLog --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2010-11-15 Rik + + * interpreter/octave.texi, interpreter/plot.txi: Rename subsection + "Printing Plots" to "Printing and Saving Plots". Add reference to + new saveas function. + 2010-11-10 John W. Eaton * interpreter/munge-texi.cc: Eliminate special case for __DECCXX. diff --git a/doc/interpreter/octave.texi b/doc/interpreter/octave.texi --- a/doc/interpreter/octave.texi +++ b/doc/interpreter/octave.texi @@ -496,8 +496,8 @@ * Plot Annotations:: * Multiple Plots on One Page:: * Multiple Plot Windows:: -* Printing Plots:: -* Interacting with plots:: +* Printing and Saving Plots:: +* Interacting with Plots:: * Test Plotting Functions:: Two-Dimensional Plots diff --git a/doc/interpreter/plot.txi b/doc/interpreter/plot.txi --- a/doc/interpreter/plot.txi +++ b/doc/interpreter/plot.txi @@ -59,8 +59,8 @@ * Plot Annotations:: * Multiple Plots on One Page:: * Multiple Plot Windows:: -* Printing Plots:: -* Interacting with plots:: +* Printing and Saving Plots:: +* Interacting with Plots:: * Test Plotting Functions:: @end menu @@ -793,9 +793,10 @@ @end float @end ifnotinfo -@node Printing Plots -@subsection Printing Plots +@node Printing and Saving Plots +@subsection Printing and Saving Plots @cindex printing plots +@cindex saving plots The @code{print} command allows you to save plots in a variety of formats. For example, @@ -810,10 +811,12 @@ @DOCSTRING(print) +@DOCSTRING(saveas) + @DOCSTRING(orient) -@node Interacting with plots -@subsection Interacting with plots +@node Interacting with Plots +@subsection Interacting with Plots The user can select points on a plot with the @code{ginput} function or selection the position at which to place text on the plot with the diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,9 @@ +2010-11-15 Rik + + * plot/saveas.m: Add function name to error messages. Use semicolons + to prevent unnecessary output. Use common terms 'ext' for extension + and 'filename' for filename in docstring. + 2010-11-15 Kai Habel * plot/saveas.m: New file. diff --git a/scripts/plot/saveas.m b/scripts/plot/saveas.m --- a/scripts/plot/saveas.m +++ b/scripts/plot/saveas.m @@ -17,37 +17,44 @@ ## . ## -*- texinfo -*- -## @deftypefn {Function File} {} saveas (@var{h}, @var{file_name}) -## @deftypefnx {Function File} {} saveas (@var{h}, @var{file_name}, @var{file_ext}) -## Save the graphic object @var{h} to file @var{file_name} in graphic -## format @var{file_ext}. +## @deftypefn {Function File} {} saveas (@var{h}, @var{filename}) +## @deftypefnx {Function File} {} saveas (@var{h}, @var{filename}, @var{ext}) +## Save the graphic object @var{h} to file @var{filename} in graphic +## format @var{ext}. ## -## @var{file_ext} should be one of the following formats: +## @var{ext} should be one of the following formats: ## ## @table @code ## @item ps ## Postscript +## ## @item eps ## Encapsulated Postscript +## ## @item jpg ## JPEG Image +## ## @item png ## PNG Image +## ## @item emf ## Enhanced Meta File +## ## @item pdf ## Portable Document Format ## @end table ## -## All device formats specified in @code{print} can also be used. If @var{file_ext} -## is omitted it is extracted from @var{file_name}. The default value is -## pdf. +## All device formats specified in @code{print} may also be used. If +## @var{ext} is omitted it is extracted from @var{filename}. The default +## value is pdf. ## ## @example +## @group ## figure (1); ## clf (); ## surf (peaks); ## saveas(1, "figure1.png"); +## @end group ## @end example ## ## @seealso{print} @@ -65,14 +72,14 @@ if (isfigure (h)) fig = h; else - fig = ancestor (h, "figure") + fig = ancestor (h, "figure"); endif else - error ("first argument must be a graphics handle"); + error ("saveas: first argument H must be a graphics handle"); endif - if (!ischar(fname)) - error ("file_name must be a string."); + if (!ischar (fname)) + error ("saveas: FILENAME must be a string"); endif if (nargin == 2) @@ -84,7 +91,7 @@ if (nargin == 3) if (!ischar (fname)) - error ("fext must be a string."); + error ("saveas: EXT must be a string"); endif [~, ~, ext] = fileparts (fname); @@ -96,5 +103,6 @@ prt_opt = strcat ("-d", tolower (fext)); - print (fname, prt_opt) + print (fname, prt_opt); + endfunction