changeset 11254:31f8534eb055

Add reference to new saveas function in printed manual. Change saveas.m to more closely follow Octave coding standards.
author Rik <octave@nomad.inbox5.com>
date Mon, 15 Nov 2010 16:52:43 -0800
parents 093c9facf0f0
children d682cd6669ac
files doc/ChangeLog doc/interpreter/octave.texi doc/interpreter/plot.txi scripts/ChangeLog scripts/plot/saveas.m
diffstat 5 files changed, 45 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/doc/ChangeLog	Mon Nov 15 19:41:14 2010 +0100
+++ b/doc/ChangeLog	Mon Nov 15 16:52:43 2010 -0800
@@ -1,3 +1,9 @@
+2010-11-15  Rik  <octave@nomad.inbox5.com>
+
+	* 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  <jwe@octave.org>
 
 	* interpreter/munge-texi.cc: Eliminate special case for __DECCXX.
--- a/doc/interpreter/octave.texi	Mon Nov 15 19:41:14 2010 +0100
+++ b/doc/interpreter/octave.texi	Mon Nov 15 16:52:43 2010 -0800
@@ -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
--- a/doc/interpreter/plot.txi	Mon Nov 15 19:41:14 2010 +0100
+++ b/doc/interpreter/plot.txi	Mon Nov 15 16:52:43 2010 -0800
@@ -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
--- a/scripts/ChangeLog	Mon Nov 15 19:41:14 2010 +0100
+++ b/scripts/ChangeLog	Mon Nov 15 16:52:43 2010 -0800
@@ -1,3 +1,9 @@
+2010-11-15  Rik  <octave@nomad.inbox5.com>
+
+	* 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  <kai.habel@gmx.de>
 
 	* plot/saveas.m: New file.
--- a/scripts/plot/saveas.m	Mon Nov 15 19:41:14 2010 +0100
+++ b/scripts/plot/saveas.m	Mon Nov 15 16:52:43 2010 -0800
@@ -17,37 +17,44 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- 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