Skip to content

streamtube coloring and positions depend on data order #4206

Description

@emmanuelle
var gd = document.getElementById('graphDiv');

var type = 'streamtube';

var allX = [];
var allY = [];
var allZ = [];
var allU = [];
var allV = [];
var allW = [];

var res = 10;
var ni = res;
var nj = res;
var nk = res;
var i, j, k;

for(var k = 0; k < nk; k++) {
    for(var j = 0; j < nj; j++) {
      for(var i = 0; i < ni; i++) {
            var x = i;
            var y = j;
            var z = k;

            allX.push(x);
            allY.push(y);
            allZ.push(z);

            var u = 0;
            var v = 0;
            var w = z;

            allU.push(u);
            allV.push(v);
            allW.push(w);

        }
    }
}

var allX2 = [];
var allY2 = [];
var allZ2 = [];
var allU2 = [];
var allV2 = [];
var allW2 = [];

for(var k = 0; k < nk; k++) {
    for(var j = 0; j < nj; j++) {
      for(var i = 0; i < ni; i++) {
            var x = k;
            var y = j;
            var z = i;

            allX2.push(x);
            allY2.push(y);
            allZ2.push(z);

            var u = 0;
            var v = 0;
            var w = z;

            allU2.push(u);
            allV2.push(v);
            allW2.push(w);

        }
    }
}

Plotly.newPlot(gd, {
  data:  [{
    type: type,
    x: allX,
    y: allY,
    z: allZ,
    u: allU,
    v: allV,
    w: allW,
    scene: 'scene1'
  },
  {
    type: type,
    x: allX2,
    y: allY2,
    z: allZ2,
    u: allU2,
    v: allV2,
    w: allW2,
    scene: 'scene2'
  },
],
  layout: {
    width: 1200,
    height: 600,
    scene1: {
      domain: {
        x: [0, 0.45]
      }
    },
    scene2: {
      domain: {
        x: [0.5, 0.95]
      }
    },
  }
}
);

newplot(2)

A codepen is available on https://codepen.io/emmanuelle-plotly/pen/PoYxZQv?editors=0010

I would not expect the viz to depend on whether x or z is the fastest varying variable.

Activity

  1. archmoj commented on Sep 19, 2019

    @archmoj
    Contributor

    In addition to color it looks there is a bug in the positions!
    In your codepen if I change the trace type from streamtube to cone, it displays the full correct data.
    Demo

  2. added this to the v1.51.0 milestone on Sep 26, 2019
  3. archmoj commented on Oct 7, 2019

    @archmoj
    Contributor

    Not sure about the cone plot sizes even: codepen

  4. etpinard commented on Oct 7, 2019

    @etpinard
    Contributor

    Not sure about the cone plot sizes even: codepen

    See #3613 for that.

  5. archmoj commented on Oct 9, 2019

    @archmoj
    Contributor

    It appears that gl-streamtube3d module makes false assumption about the order of data!
    https://github.com/gl-vis/gl-streamtube3d/blob/533bf21665b8849542756402ffc0800b932cffec/streamtube.js#L242-L249

  6. etpinard commented on Oct 9, 2019

    @etpinard
    Contributor

    Nice find @archmoj !

  7. changed the title [-]streamtube coloring depends on data order[/-] [+]streamtube coloring and positions depends on data order[/+] on Oct 10, 2019
  8. archmoj commented on Oct 10, 2019

    @archmoj
    Contributor

    @emmanuelle what do you think of this fix?
    codepen
    Do the normals make sense e.g. when compared with cone.

  9. archmoj commented on Oct 10, 2019

    @archmoj
    Contributor

    Here is another example to help test changes.
    codepen

  10. changed the title [-]streamtube coloring and positions depends on data order[/-] [+]streamtube coloring and positions depend on data order[/+] on Oct 10, 2019
  11. emmanuelle commented on Oct 11, 2019

    @emmanuelle
    ContributorAuthor

    Thank you @archmoj it looks good now :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions