changeset 6412:b2096bb759b1

[project @ 2007-03-15 02:33:45 by jwe]
author jwe
date Thu, 15 Mar 2007 02:36:10 +0000
parents 2f64090cdc14
children cf8e671beada
files scripts/ChangeLog scripts/miscellaneous/Makefile.in scripts/plot/__axis_label__.m scripts/plot/title.m scripts/plot/xlabel.m scripts/plot/ylabel.m scripts/plot/zlabel.m
diffstat 7 files changed, 43 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Mar 14 22:06:15 2007 +0000
+++ b/scripts/ChangeLog	Thu Mar 15 02:36:10 2007 +0000
@@ -1,5 +1,13 @@
 2007-03-14  John W. Eaton  <jwe@octave.org>
 
+	* plot/__axis_label__.m: Accept additional property-value pairs
+	and pass them to __go_text__.  Simply return the handle obtained
+	from __go_text__ instead of calling get on the current axis.
+	* plot/xlabel.m, plot/zlabel.m, plot/zlabel.m: Check args here.
+	Allow for extra property value pairs to be passed along.
+	* plot/title.m: Implement with __axis_label__ since it does all
+	that title needs to do.
+
 	* plot/clf.m: Set currentaxes property for current figure to [].
 
 	* plot/__axis_label__.m: Convert arg to text handle before calling set.
--- a/scripts/miscellaneous/Makefile.in	Wed Mar 14 22:06:15 2007 +0000
+++ b/scripts/miscellaneous/Makefile.in	Thu Mar 15 02:36:10 2007 +0000
@@ -20,7 +20,7 @@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 
-SOURCES = ans.m bincoeff.m bug_report.m bunzip2.m comma.m \
+SOURCES = ans.m bincoeff.m bug_report.m bunzip2.m cast.m comma.m \
   compare_versions.m computer.m copyfile.m cputime.m \
   delete.m dir.m doc.m dos.m dump_prefs.m \
   fileattrib.m fileparts.m flops.m fullfile.m getfield.m gunzip.m \
--- a/scripts/plot/__axis_label__.m	Wed Mar 14 22:06:15 2007 +0000
+++ b/scripts/plot/__axis_label__.m	Thu Mar 15 02:36:10 2007 +0000
@@ -24,22 +24,18 @@
 
 ## Author: jwe
 
-function retval = __axis_label__ (caller, txt)
-
-  ## If we have an even number of arguments, they should be
-  ## property-value pirs.
+function retval = __axis_label__ (caller, txt, varargin)
 
-  if (nargin == 2)
-    if (ischar (txt))
-      ca = gca ();
-      ## FIXME -- should be able to use text instead of __go_text__.
-      set (ca, caller, __go_text__ (ca, "string", txt));
-      if (nargout > 0)
-	retval = get (ca, caller);
-      endif
+  if (ischar (txt))
+    ## FIXME -- should be able to use text instead of __go_text__.
+    ca = gca ();
+    h = __go_text__ (ca, "string", txt, varargin{:});
+    set (ca, caller, h);
+    if (nargout > 0)
+      retval = h;
     endif
   else
-    print_usage ();
+    error ("%s: expecting first argument to be character string");
   endif
 
 endfunction
--- a/scripts/plot/title.m	Wed Mar 14 22:06:15 2007 +0000
+++ b/scripts/plot/title.m	Thu Mar 15 02:36:10 2007 +0000
@@ -26,17 +26,11 @@
 
 function retval = title (varargin)
 
-  nargs = nargin;
-
-  if (nargs == 0)
-    varargin{1} = "";
-    nargs++;
-  endif
-
-  if (nargs == 1)
-    set (gca, "title", varargin{1});
+  if (rem (nargin, 2) == 1)
     if (nargout > 0)
-      retval = h;
+      h = __axis_label__ ("title", varargin{:});
+    else
+      __axis_label__ ("title", varargin{:});
     endif
   else
     print_usage ();
--- a/scripts/plot/xlabel.m	Wed Mar 14 22:06:15 2007 +0000
+++ b/scripts/plot/xlabel.m	Thu Mar 15 02:36:10 2007 +0000
@@ -32,10 +32,14 @@
 
 function h = xlabel (varargin)
 
-  if (nargout > 0)
-    h = __axis_label__ ("xlabel", varargin{:});
+  if (rem (nargin, 2) == 1)
+    if (nargout > 0)
+      h = __axis_label__ ("xlabel", varargin{:});
+    else
+      __axis_label__ ("xlabel", varargin{:});
+    endif
   else
-    __axis_label__ ("xlabel", varargin{:});
+    print_usage ();
   endif
 
 endfunction
--- a/scripts/plot/ylabel.m	Wed Mar 14 22:06:15 2007 +0000
+++ b/scripts/plot/ylabel.m	Thu Mar 15 02:36:10 2007 +0000
@@ -26,10 +26,14 @@
 
 function h = ylabel (varargin)
 
-  if (nargout > 0)
-    h = __axis_label__ ("ylabel", varargin{:});
+  if (rem (nargin, 2) == 1)
+    if (nargout > 0)
+      h = __axis_label__ ("ylabel", varargin{:});
+    else
+      __axis_label__ ("ylabel", varargin{:});
+    endif
   else
-    __axis_label__ ("ylabel", varargin{:});
+    print_usage ();
   endif
 
 endfunction
--- a/scripts/plot/zlabel.m	Wed Mar 14 22:06:15 2007 +0000
+++ b/scripts/plot/zlabel.m	Thu Mar 15 02:36:10 2007 +0000
@@ -26,10 +26,14 @@
 
 function h = zlabel (varargin)
 
-  if (nargout > 0)
-    h = __axis_label__ ("zlabel", varargin{:});
+  if (rem (nargin, 2) == 1)
+    if (nargout > 0)
+      h = __axis_label__ ("zlabel", varargin{:});
+    else
+      __axis_label__ ("zlabel", varargin{:});
+    endif
   else
-    __axis_label__ ("zlabel", varargin{:});
+    print_usage ();
   endif
 
 endfunction