octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more graphics changes.


From: John W. Eaton
Subject: Re: more graphics changes.
Date: Wed, 14 Mar 2007 19:42:19 -0400

On 14-Mar-2007, Daniel J Sebald wrote:

| During compilation:
| 
| 
| making vr-idx.texi from vr-idx.txi
| vr-idx.texi is unchanged
| DISPLAY= ../../run-octave -f -q -H -p . --eval "sparseimages ('grid', 'eps'); 
sleep (1);"
| error: invalid conversion from string to real scalar
| error: set: expecting title to be a graphics handle
| error: evaluating if command near line 36, column 3
| error: called from `title' in file 
`/usr/local/src/octave-cvs/octave/scripts/plot/title.m'
| error: evaluating if command near line 219, column 3
| error: called from `sparseimages:sombreroimage' in file 
`/usr/local/src/octave-cvs/octave/doc/interpreter/sparseimages.m'
| error: evaluating if command near line 2, column 3
| error: called from `sparseimages' in file 
`/usr/local/src/octave-cvs/octave/doc/interpreter/sparseimages.m'
| 
| make[3]: *** [grid.eps] Error 1
| make[3]: Leaving directory `/usr/local/src/octave-cvs/octave/doc/interpreter'
| make[2]: *** [interpreter] Error 2
| make[2]: Leaving directory `/usr/local/src/octave-cvs/octave/doc'
| make[1]: *** [doc] Error 2
| make[1]: Leaving directory `/usr/local/src/octave-cvs/octave'
| make: *** [all] Error 2

I think the following patch will fix this problem, plus it allows
properties to be specified in the title and {x,y,z}label commands.

Thanks,

jwe


scripts/ChangeLog:

2007-03-14  John W. Eaton  <address@hidden>

        * 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.


Index: scripts/plot/__axis_label__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__axis_label__.m,v
retrieving revision 1.15
diff -u -u -r1.15 __axis_label__.m
--- scripts/plot/__axis_label__.m       14 Mar 2007 16:51:29 -0000      1.15
+++ scripts/plot/__axis_label__.m       14 Mar 2007 23:39:43 -0000
@@ -24,22 +24,18 @@
 
 ## Author: jwe
 
-function retval = __axis_label__ (caller, txt)
+function retval = __axis_label__ (caller, txt, varargin)
 
-  ## If we have an even number of arguments, they should be
-  ## property-value pirs.
-
-  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
Index: scripts/plot/title.m
===================================================================
RCS file: /cvs/octave/scripts/plot/title.m,v
retrieving revision 1.31
diff -u -u -r1.31 title.m
--- scripts/plot/title.m        30 Jan 2007 19:16:54 -0000      1.31
+++ scripts/plot/title.m        14 Mar 2007 23:39:43 -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 ();
Index: scripts/plot/xlabel.m
===================================================================
RCS file: /cvs/octave/scripts/plot/xlabel.m,v
retrieving revision 1.24
diff -u -u -r1.24 xlabel.m
--- scripts/plot/xlabel.m       30 Jan 2007 19:16:54 -0000      1.24
+++ scripts/plot/xlabel.m       14 Mar 2007 23:39:43 -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
Index: scripts/plot/ylabel.m
===================================================================
RCS file: /cvs/octave/scripts/plot/ylabel.m,v
retrieving revision 1.21
diff -u -u -r1.21 ylabel.m
--- scripts/plot/ylabel.m       30 Jan 2007 19:16:54 -0000      1.21
+++ scripts/plot/ylabel.m       14 Mar 2007 23:39:43 -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
Index: scripts/plot/zlabel.m
===================================================================
RCS file: /cvs/octave/scripts/plot/zlabel.m,v
retrieving revision 1.17
diff -u -u -r1.17 zlabel.m
--- scripts/plot/zlabel.m       30 Jan 2007 19:16:54 -0000      1.17
+++ scripts/plot/zlabel.m       14 Mar 2007 23:39:43 -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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]