Skip to content

Tubes disappear when meshgrid is too fine #4

@etpinard

Description

@etpinard

@kig try

var s0 = -5, s1 = 6, ds = 0.5
var s = [];

for (var i = 0; i < (s1 - s0) / ds; i++) {
  s.push(s0 + ds * i)
} 

var x = s, y = s, z = s;
    
var len = x.length * y.length * z.length;
var u=[],v=[],w=[]; 
for (var i=0; i<len; i++) { 
   u.push(1+Math.sin(i)); 
   v.push(Math.cos(i));
   w.push(Math.sin(i*0.3)*0.3);
}

var cx=[],cy=[],cz=[];
for (var i=0; i<7; i++) { 
  for(var j=0; j<7; j++) { 
    cx.push(-5); cy.push(i-3); cz.push(j-3);
  }
}

    Plotly.newPlot(gd, [{
      type: 'streamtube',
      startx: cx, starty: cy, startz: cz,
      u: u, v: v, w: w,
      x: x, y: y, z: z,
      colorscale: 'Viridis'
    }], {
       scene: {
         xaxis: {range: [-5,5]},
         yaxis: {range: [-5,5]},
         zaxis: {range: [-5,5]}
       }
    })

off the latest commit off plotly/plotly.js#2658,

I'm getting a blank scene:

image

whereas for ds values >= 0.6, things appear to work ok. For example with ds: 0.6:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions