stem plot problem
Ben Abbott
bpabbott at mac.com
Fri Oct 17 20:56:36 CDT 2008
On Oct 17, 2008, at 9:18 PM, Ben Abbott wrote:
>
> On Oct 17, 2008, at 5:51 PM, Ben Abbott wrote:
>
>> On Friday, October 17, 2008, at 02:45PM, "John W. Eaton" <jwe at bevo.che.wisc.edu
>> > wrote:
>>> I'm seeing the following problem with the current development
>>> sources
>>> (this is demo 7 in stem.m):
>>>
>>> octave:1> x = [0:10].';
>>> octave:2> y = [sin(x), cos(x)];
>>> octave:3> h = stem (x, y);
>>> octave:4> set (h(2), "color", "g");
>>> octave:5> set (h(1), "basevalue", 1)
>>> error: number of rows must match (33 != 11) near line 468, column 33
>>> error: called from:
>>> error: /home/jwe/src/octave/scripts/plot/__go_draw_axes__.m at
>>> line 468, column 24
>>> error: /home/jwe/src/octave/scripts/plot/__go_draw_figure__.m at
>>> line 56, column 8
>>> error: /home/jwe/src/octave/scripts/plot/gnuplot_drawnow.m at
>>> line 68, column 5
>>>
>>> The problem appears to be this concatenation at line 465 in
>>> __go_draw_axes__.m:
>>>
>>> data{data_idx} = [xdat, ydat]';
>>>
>>> Again, I don't understand what is supposed to be happening, or why
>>> xdat has 11 elements and ydat has 33 at this point. I could use
>>> some help fixing this problem.
>>>
>>> jwe
>>
>> I don't think the problem is in __go_draw_axes__.m
>>
>> If the last line of that demo is removed (the one below), there is
>> no error.
>>
>> %! set (h(1), "basevalue", -1)
>>
>> I inserted the lines below ahead of the error
>>
>> %! get(get(get (h(1),'children')(1), 'children'), 'xdata')
>> %! get(get(get (h(1),'children')(1), 'children'), 'ydata')
>> %! get(get(get (h(1),'children')(2), 'children'), 'xdata')
>> %! get(get(get (h(1),'children')(2), 'children'), 'ydata')
>>
>> The 1st & 2nd produce a 1x11 vector
>> The 3rd & 4th produce a 1x33 vector
>>
>> After examining the line that fails in __go_draw_axes__.m, it
>> appears an attempt is made to plot the xdata from the 1st with the
>> ydata from the 4th.
>>
>> I'll have to bone up on what "basevalue" is before going any deeper.
>>
>>
>> The handle h(1) points to an hggroup. Looking at the lines of the
>> group all the xdata and ydata appear to be correct. Once the set
>> command gets run, I'm not sure what the sequence of events is.
>>
>> Ben
>
> ok, I'm in over my head, but it appears that the problem is with
> "update_props" .... and for those "in the know", the question is
> which "update_props"?
>
> In __stem__.m it is defined as ...
>
> 509 function update_props (h, d)
> 510 kids = get (h, "children");
> 511 set (kids(1), "color", get (h, "color"),
> 512 "linewidth", get (h, "linewidth"),
> 513 "linestyle", get (h, "linestyle"));
> 514 set (kids(2), "color", get (h, "color"),
> 515 "marker", get (h, "marker"),
> 516 "markerfacecolor", get (h, "markerfacecolor"),
> 517 "markersize", get (h, "markersize"));
> 518 endfunction
>
> In __add_line_series__.m
>
> 52 function update_props (h, d)
> 53 set (get (h, "children"), "color", get (h, "color"),
> 54 "linewidth", get (h, "linewidth"),
> 55 "linestyle", get (h, "linestyle"),
> 56 "marker", get (h, "marker"),
> 57 "markerfacecolor", get (h, "markerfacecolor"),
> 58 "markeredgecolor", get (h, "markeredgecolor"),
> 59 "markersize", get (h, "markersize"),
> 60 "xdata", get (h, "xdata"),
> 61 "ydata", get (h, "ydata"),
> 62 "zdata", get (h, "zdata"));
> 63 endfunction
>
> I suggest such after pasting the lines below into the octave console
>
> x = [0 : 10].';
> y = [sin(x), cos(x)];
> h = stem (x, y);
> set (h(2), "color", "g");
> set (h(1), "basevalue", -1)
>
> Which produced the following ...
>
> octave:158> x = [0 : 10].';
> octave:159> y = [sin(x), cos(x)];
> octave:160> h = stem (x, y);
> octave:161> set (h(2), "color", "g");
> octave:162> set (h(1), "basevalue", -1)
>
> error: invalid value for array property "ydata"
> error: set: expecting argument 18 to be a property name
> error: called from:
> error: /Users/bpabbott/Development/mercurial/octave-3.1.51/scripts/
> plot/__add_line_series__.m at line 56, column 1
> error: invalid graphics handle
> error: /Users/bpabbott/Development/mercurial/octave-3.1.51/scripts/
> plot/__stem__.m at line 509, column 3
> error: invalid graphics handle
> error: /Users/bpabbott/Development/mercurial/octave-3.1.51/scripts/
> plot/__stem__.m at line 479, column 2
> error: invalid graphics handle
> error: /Users/bpabbott/Development/mercurial/octave-3.1.51/scripts/
> plot/__stem__.m at line 495, column 5
> octave:162>
>
> This is getting a bit too much for a guy on a Friday night with 3
> beers behind him, so I'm off to other entertainment .... until
> tomorrow ;-)
>
> Ben
ok a new observation that even a guy with four beers behind him can see
x = [0 : 10].';
y = [sin(x), cos(x)];
h = stem (x, y);
set (h(2), "color", "g");
set (h(1), "basevalue", -1)
The last command produces the error, but if move_baeeline() in
__stem__.m as
487 function move_baseline (h, d)
488 b0 = get (h, "basevalue");
489 bl = get (h, "baseline");
490
491 if (get (bl, "ydata") != [b0, b0])
492 set (bl, "ydata", [b0, b0]);
493 endif
494
495 kids = get (h, "children");
496 yt = get(h, "ydata");
497 if (size (yt, 1) == 1)
498 yt = yt(:)';
499 ny = length (yt);
500 yt = [b0 * ones(1, ny); yt; NaN(1, ny)](:);
501 else
502 yt = yt(:);
503 ny = length (yt);
504 yt = [b0 * ones(ny, 1), yt, NaN(ny, 1)];
505 endif
506 set (kids(1), "ydata", yt);
507 endfunction
and the command below is submitted twice
set (h(1), "basevalue", -1)
All works as it should.
Perhaps there is something of a recursive nature that is breaking this?
Ben
More information about the Octave-maintainers
mailing list