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

Tubes disappear when meshgrid is too fine #4

Open
etpinard opened this issue May 29, 2018 · 2 comments
Open

Tubes disappear when meshgrid is too fine #4

etpinard opened this issue May 29, 2018 · 2 comments

Comments

@etpinard
Copy link
Member

@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

@etpinard etpinard changed the title Tube disappear when meshgrid is too fine Tubes disappear when meshgrid is too fine May 29, 2018
@etpinard
Copy link
Member Author

etpinard commented May 30, 2018

Post plotly/plotly.js#2658 (comment), this might be a non-issue, as meshgrid are on their way out (at least for the plotly.js v1 integration).

@kig
Copy link
Collaborator

kig commented May 31, 2018

I think this is because the starting points are right at the edge of the meshgrid, and sampling outside the meshgrid results in zero vectors and no streams. I changed the cx value to -4.9 and that got me tubes whereas -5 came up empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants