Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streamtube coloring and positions depend on data order #4206

Closed
emmanuelle opened this issue Sep 19, 2019 · 8 comments · Fixed by #4271
Closed

streamtube coloring and positions depend on data order #4206

emmanuelle opened this issue Sep 19, 2019 · 8 comments · Fixed by #4271
Assignees
Labels
bug something broken
Milestone

Comments

@emmanuelle
Copy link
Contributor

emmanuelle commented Sep 19, 2019

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.

@etpinard etpinard added the bug something broken label Sep 19, 2019
@archmoj
Copy link
Contributor

archmoj commented Sep 19, 2019

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

@etpinard etpinard added this to the v1.51.0 milestone Sep 26, 2019
@archmoj
Copy link
Contributor

archmoj commented Oct 7, 2019

Not sure about the cone plot sizes even: codepen

@etpinard
Copy link
Contributor

etpinard commented Oct 7, 2019

Not sure about the cone plot sizes even: codepen

See #3613 for that.

@archmoj
Copy link
Contributor

archmoj commented Oct 9, 2019

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

@etpinard
Copy link
Contributor

etpinard commented Oct 9, 2019

Nice find @archmoj !

@archmoj archmoj changed the title streamtube coloring depends on data order streamtube coloring and positions depends on data order Oct 10, 2019
@archmoj
Copy link
Contributor

archmoj commented Oct 10, 2019

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

@archmoj
Copy link
Contributor

archmoj commented Oct 10, 2019

Here is another example to help test changes.
codepen

@archmoj archmoj changed the title streamtube coloring and positions depends on data order streamtube coloring and positions depend on data order Oct 10, 2019
@emmanuelle
Copy link
Contributor Author

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
Labels
bug something broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants