The patch below fixes a problem with the following use of scatter(): octave:1> n=101; scatter(ones(n,1), ones(n,1), 1, zeros(n,3)) error: __scatter__: A(I,J): row index out of bounds; value 101 out of bound 1 error: called from: error: /usr/share/octave/3.4.3/m/plot/private/__scatter__.m at line 201, column 10 error: /usr/share/octave/3.4.3/m/plot/scatter.m at line 71, column 11
The issue is triggered only for n > 100 samples, and an n-by-3 matrix for the color argument. In that case, a set of unique colors cc is computed in order to plot samples with the same color in one go. The number of iterations necessary to plot all colors is derived from the wrong variable. --- I did not find any specific requirements for submitting patches to this mailing list. So I simply used hg to generate the following diff based on changeset 13868:87f78c11d725. FWIW, I came across this issue while working on ml-class.org's programming exercise 7. Cheers, Clemens scripts/plot/private/__scatter__.m | 4 ++-- scripts/plot/scatter.m | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff -r 87f78c11d725 scripts/plot/private/__scatter__.m --- a/scripts/plot/private/__scatter__.m Tue Nov 15 01:29:22 2011 -0500 +++ b/scripts/plot/private/__scatter__.m Sun Dec 04 15:21:09 2011 +0100 @@ -197,12 +197,12 @@ else [cc, idx] = unique_idx (c, "rows"); if (isscalar (s)) - for i = 1:rows (x) + for i = 1:rows (cc) h = render_size_color (hg, vert(idx{i},:), s, cc(i,:), marker, filled, true); endfor else - for i = 1:rows (x) + for i = 1:rows (cc) h = render_size_color (hg, vert(idx{i},:), s(idx{i}), cc(i,:), marker, filled, true); endfor diff -r 87f78c11d725 scripts/plot/scatter.m --- a/scripts/plot/scatter.m Tue Nov 15 01:29:22 2011 -0500 +++ b/scripts/plot/scatter.m Sun Dec 04 15:21:09 2011 +0100 @@ -92,6 +92,13 @@ %! scatter (x, y, [], sqrt(x.^2 + y.^2)); %!demo +%! x = randn (100, 1); +%! y = randn (100, 1); +%! s = 10; +%! c = randi ([0 256], 100, 3)/256; +%! scatter (x, y, s, c); + +%!demo %! rand_10x1_data1 = [0.171577, 0.404796, 0.025469, 0.335309, 0.047814, 0.898480, 0.639599, 0.700247, 0.497798, 0.737940]; %! rand_10x1_data2 = [0.75495, 0.83991, 0.80850, 0.73603, 0.19360, 0.72573, 0.69371, 0.74388, 0.13837, 0.54143]; %! x = rand_10x1_data1; ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev