question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

streamtube coloring and positions depend on data order

See original GitHub issue
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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
etpinardcommented, Oct 9, 2019

Nice find @archmoj !

1reaction
archmojcommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

The figure data structure in Python - Plotly
Detailed examples of The Figure Data Structure including changing color, size, log axes, and more in Python.
Read more >
Streamlines and Streamtubes
A streamline is a line that is tangential to the instantaneous velocity direction (velocity is a vector, and it has a magnitude and...
Read more >
Laplace's Eqn & Flow Nets Streamline - New Mexico Tech
Depending on the number of flow lines selected, the number of equipotential lines will automatically be fixed by geometry and grid layout. After...
Read more >
Python Plotly tutorial - GeeksforGeeks
A bubble plot is a scatter plot with bubbles (color-filled circles). Bubbles have various sizes dependent on another variable in the data.
Read more >
ParaView
Scientific visualization: specifically concerned with data that has a well-defined representation in 2D or 3D space (e.g., from simulation mesh or scanner).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found