« Return to Thread: Issue with hggroup and zlim

Re: Issue with hggroup and zlim

by David Bateman :: Rate this Message:

Reply to Author | View in Thread

John W. Eaton wrote:

> On 28-Aug-2008, dbateman wrote:
>
> | John W. Eaton wrote:
> | >
> | > Looking at __add_datasource__.m, I see
> | >
> | >   i = 1;
> | >   newargs = {};
> | >   while (i < numel (varargin))
> | >     arg = varargin{i++};
> | >     if (ischar (arg) && length (arg > 1) && strcmpi (arg(2:end),
> | > "datasource"))
> | >       arg = tolower (arg);
> | >       val = varargin{i++};
> | >       if (ischar (val))
> | > set (h, arg, val);
> | >       else
> | > error ("%s: expecting data source to be a string", fcn);
> | >       endif
> | >     else
> | >       newargs{end + 1} = arg;
> | >     endif
> | >   endwhile
> | >
> | > Should the test in this loop be <= instead of < ?  If so, then newargs
> | > will contain the parent argument and the calls to __line__ in plot3
> | > will need to be modified.  For example, I would propose this change:
> | >
> |
> | No as property/value occur in pairs.
>
> I'm confused.  Does __add_datasource__ require that varargin is a list
> of property value pairs?  If yes, then why not write the loop as
>
>   for i = 1:2:numel (varargin)
>     key = varargin{i};
>     val = varargin{i+1}
>     if (length (key > 1) && strcmpi (key(2:end), "datasource"))
>       if (ischar (val))
>         set (h, key, val);
>       else
>         error ("%s: expecting data source to be a string", fcn);
>       endif
>     else
>       newargs(end+1:end+2) = {key, val};
>     endif
>   endwhile
>    
> ?
>
> | However varargin{i++} should read
> | varargin{++i} or i should be initialized to 0.
>
> I don't see how that can be "or".  Do you mean "and", and that i++
> should be switched to ++i in both cases?
>
> | As for the change in plot3.m
> | this is incorrect as the explicit reparenting to the hggroup is needed. Your
> | second reparenting will just override that.
>
> OK.
>
> What about the call to __add_line_series__?  Should the first argument
> be hline instead of h?
>
>  
I'd suggest the attached changeset instead.. And yes it should be hline
and not h in plot3.

D.

--
David Bateman                                David.Bateman@...
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

The information contained in this communication has been classified as:

[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary


# HG changeset patch
# User David Bateman <dbateman@...>
# Date 1220006139 -7200
# Node ID bc6ec8356a900e3c23d3e237d3ab1059138add53
# Parent  5b66c24bd777029cf242b0d54fa32feefbbd8fc6
Small fix to plot3 and data sources code

diff --git a/scripts/plot/__add_datasource__.m b/scripts/plot/__add_datasource__.m
--- a/scripts/plot/__add_datasource__.m
+++ b/scripts/plot/__add_datasource__.m
@@ -32,13 +32,14 @@ function newargs = __add_datasource__ (f
     addproperty (strcat (data{i}, "datasource"), h, "string", "");
   endfor
 
-  i = 1;
+  i = 0;
   newargs = {};
   while (i < numel (varargin))
-    arg = varargin{i++};
-    if (ischar (arg) && length (arg > 1) && strcmpi (arg(2:end), "datasource"))
+    arg = varargin{++i};
+    if (i != numel(varargin) && ischar (arg) &&
+ length (arg > 1) && strcmpi (arg(2:end), "datasource"))
       arg = tolower (arg);
-      val = varargin{i++};
+      val = varargin{++i};
       if (ischar (val))
  set (h, arg, val);
       else
diff --git a/scripts/plot/plot3.m b/scripts/plot/plot3.m
--- a/scripts/plot/plot3.m
+++ b/scripts/plot/plot3.m
@@ -303,7 +303,7 @@ function retval = plot3 (varargin)
   "linestyle", options.linestyle,
   "marker", options.marker, "parent", hg, properties{:});
 
-    __add_line_series__ (h, hg);
+    __add_line_series__ (hline, hg);
   endif
 
   set (gca (), "view", [-37.5, 30]);

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

 « Return to Thread: Issue with hggroup and zlim