bugGNU Octave - Bugs: bug #47237, scatter plot update_data callback...

 
 

bug #47237: scatter plot update_data callback only works when number of points <= 100

Submitter:  None
Submitted:  Tue 23 Feb 2016 05:21:07 PM UTC
   
 
Category:  Plotting with gnuplot Severity:  3 - Normal
Priority:  3 - Low Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Francisco Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 02 Jun 2020 01:42:12 AM UTC, comment #7: 

I spent a long time debugging before knowing about this bug report. I paste here a minimal code to reproduce the bug in the hope of saving time for whoever is going to work on this issue.


graphics_toolkit gnuplot
magicN = 100;
X = rand(magicN, 2);
palette = hsv(2);
colors = palette ([ones(magicN/2, 1); 2*ones(magicN/2, 1)], :);
scatter(X(:,1), X(:,2), 65, colors);
stickyColor = randi([1 2]);
scatter([X(:,1); 0.5] , [X(:,2); 0.5], 165, [palette(stickyColor, :); colors]);


Daniel Molina García <dmolina>
Sun 10 May 2020 07:07:30 PM UTC, comment #6: 

This should be working natively with the new scatter object implemented for bug #58282.

When the "gnuplot" graphics toolkit is used, the previous implementation with a hg group of patch objects is still used. With that the limitation still applies.

Changing category to "Plotting with gnuplot".

Markus Mützel <mmuetzel>
Group administrator
Sun 03 Jul 2016 11:20:11 AM UTC, comment #5: 

Rik, I saw that only one loop would run.  It was just maintainability I was asking about.

Here are two patches.  The first goes from eight loops to four by merging cases with different edge colours.  The second goes from four to two by merging the 2D and 3D cases.  I personally find spot-the-difference code really hard to maintain, but you know better than me if the  z{i}=[]  trick is worse.

I'm happy for these to wait until after 4.2.0, since you're busy.

(file #37682, file #37683)

Lachlan Andrew <lachlan>
Sat 02 Jul 2016 06:00:47 PM UTC, comment #4: 

@Lachlan: The reason for the 100 points is performance.  The base code creates two very different implementations based on the number of points.  The callback is not set up to shift from one implementation to the other, so the best thing was simply to warn that it couldn't accomplish that shift.

As for the duplicate loops, they won't be a performance issue since only one of them will ever be chosen.  But you are right that it is a lot of code to maintain.  If you want to submit a patch that reduces the number of loops from 8 to 4 I can review and push.

Rik <rik5>
Group administrator
Fri 24 Jun 2016 04:57:42 AM UTC, comment #3: 

Rik, what is the reason for the limit of 100?  Looking at the patch in isolation, it seems to be entirely self-imposed.

Does it call something that fails with more than 100 points?

Is it a performance consideration?

Also, is there a reason for duplicating the loops for "markerfacecolor" equal to c vs "none"?  Couldn't we set


  if (filled)
    mfc = c;
  else
    mfc = "none";
  endif


and similarly with "flat" vs "none", to give four loops instead of eight?

(Now it's my turn to argue for simple=maintainable code :)

Lachlan Andrew <lachlan>
Wed 24 Feb 2016 07:15:04 PM UTC, comment #2: 

The problem is the update_data callback routine in _scatter_.m.  I don't think this was ever updated after the main part of the algorithm was changed.  I fixed this here (http://hg.savannah.gnu.org/hgweb/octave/rev/fb7f40558553) and your example now runs properly.

However, the fix only captures the case where the number of points is <= 100.  I've re-titled the bug to reflect the still open issue.

The fix will be a part of the 4.2 release. Because this is just an m-file you can also download it from the Mercurial repository and install it on your function path if you want the fix earlier.

Rik <rik5>
Group administrator
Tue 23 Feb 2016 05:38:38 PM UTC, comment #1: 

Confirmed.  The bug is also present on the development branch.

Rik <rik5>
Group administrator
Tue 23 Feb 2016 05:21:07 PM UTC, original submission:  

try the following code to change the data in a scatter plot
figure
h = scatter3([1 2], [3 4], [5 6],'k')
set(h,'XData',[3 4])

The set command fails with the following comment:
error: invalid use of colon in function argument list
error: called from
    _scatter_>update_data at line 381 column 7
error: evaluating argument list element number 1
error: called from
    _scatter_>update_data at line 381 column 7
error: evaluating argument list element number 5
error: called from
    _scatter_>update_data at line 381 column 7

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dmolina (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-11 rik5 Operating SystemMicrosoft Windows Any
    2020-05-11 rik5 Priority5 - Normal 3 - Low
    2020-05-10 mmuetzel CategoryPlotting Plotting with gnuplot
    2016-07-03 lachlan Attached File- Added bug_47237_scatter_4_loops.cset, #37682
        Attached File- Added bug_47237_scatter_2_loops.cset, #37683
    2016-02-24 rik5 Release4.0.0 dev
        SummaryI cannot set the Data properties (X, Y or Z) of a scatter or scatter3 plot scatter plot update_data callback only works when number of points <= 100
    2016-02-23 rik5 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code