bugGNU Octave - Bugs: bug #41166, scatter with mix of int and double...


bug #41166: scatter with mix of int and double - casts double to integer class

Submitted by:  CarnĂ« Draug <carandraug>
Submitted on:  Thu 09 Jan 2014 07:07:08 PM UTC  
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 14 Dec 2018 07:00:33 AM UTC, comment #3: 

This was easy to fix.  As jwe suggested, the problem in _scatter_ was that the vertices matrix was formed with

"vertices", [x(i), y(i), z(i,:)]

I changed the input validation to cast mixtures of floating point and integer data to floating point only.  See https://hg.savannah.gnu.org/hgweb/octave/rev/59bc720d1bf9.

Marking as fixed and closing report. 

Rik <rik5>
Project Administrator
Fri 25 Nov 2016 11:06:47 PM UTC, comment #2: 

This issue is still present in Octave 4.2.0.

Hartmut <hardy>
Thu 09 Jan 2014 07:19:32 PM UTC, comment #1: 

I think the problem is that when _scatter_ is setting the values for the vertices, it is doing things like [x, y, z] and when operations like that involve a mixture of int and double values, the result is the int value.  That's not going to change (required for Matlab compatibility among other reasons) so we need to fix _scatter_ to avoid using this method of constructing the vertex values.

John W. Eaton <jwe>
Project Administrator
Thu 09 Jan 2014 07:07:08 PM UTC, original submission:  

Given two datasets with different classes, scatter seems to be doing something funny with it:

graphics_toolkit fltk;
x = rand(10) * 3;
y = randi ([0 255], 10, "uint8");
figure; scatter (x(:), y(:));
figure; scatter (x(:), double(y(:)));

It would appear that it casts the x data (class double), to uint8 (the class of y) since all x values are plotted as integers.

Carnë Draug <carandraug>
Project Member


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by carandraug (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-14 rik5 Open/ClosedOpen => Closed
    2018-12-14 rik5 StatusConfirmed => Fixed
    2016-11-17 mtmiller CategoryPlotting with OpenGL => Plotting
        Release3.8.0 => dev
    2014-12-29 rik5 StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.5