Streamtubes with Real Data

I’ve recently gotten into plotly and have been having trouble with plotting streamtubes.
I am trying to emulate this plot:
https://plot.ly/~empet/14972/vector-field-visualization-with/#/
but with velocity data (u,v,w) from model output.
My u,v, and w arrays are of dimensions: 61x61x40 (x,y,z) and I would like to plot streamtubes at the z = 0 plane every 5 horizontal gridpoints. (i.e., (0,0,0), (5,0,0), (10,0,0)…, (0,5,0), (0,10,0), etc.)

I have gotten something to plot (https://plot.ly/~enochjo2/180/streamtubes-in-the-abc-flow/), but based on the periodicity in the plot output (and from other separate contour plots), it seems that I do not have the indexing of the plots down correctly.

###########################################
sx=np.linspace(0, 12, 13)
sx, sy=np.meshgrid(sx, sx)
sz=10*np.ones(sx.shape)

pl_ice = [[0.0, ‘rgb(3, 5, 18)’],
[0.11, ‘rgb(27, 26, 54)’],
[0.22, ‘rgb(48, 46, 95)’],
[0.33, ‘rgb(60, 66, 136)’],
[0.44, ‘rgb(62, 93, 168)’],
[0.56, ‘rgb(66, 122, 183)’],
[0.67, ‘rgb(82, 149, 192)’],
[0.78, ‘rgb(106, 177, 203)’],
[0.89, ‘rgb(140, 203, 219)’],
[1, ‘rgb(188, 227, 235)’]
]

x,y,z=np.mgrid[0:12:13j,0:12:13j,0:7:8j]

streamtubes=dict(type=‘streamtube’,
x=x.flatten(),
y=y.flatten(),
z=z.flatten(),
u=uinterp1[::5,::5,::5].flatten(),
v=vinterp1[::5,::5,::5].flatten(),
w=winterp1[::5,::5,::5].flatten(),
starts=dict(x=sx.flatten(),
y=sy.flatten(),
z=sz.flatten()),
maxdisplayed=1000,
sizeref=0.25,
colorscale=pl_ice,
reversescale=True,
showscale=True,
colorbar=dict(thickness=20, ticklen=4, len=0.75),
)

axis = dict(showbackground=True,
backgroundcolor=“rgb(235, 235,235)”,
gridcolor=“rgb(255, 255, 255)”,
zerolinecolor=“rgb(255, 255, 255)”)

layout = dict(title=‘Streamtubes in the ABC-flow’,
width=650,
height=600,
autosize=False,
scene=dict(camera=dict(eye=dict(x=1.15, y=1.15, z=0.6)),
xaxis=dict(axis),
yaxis=dict(axis),
zaxis=dict(axis),
aspectratio=dict(x=1,
y=1,
z=0.9))
)
fig = go.Figure(data=[streamtubes], layout=layout)
py.iplot(fig, filename=‘streamtubesz-ABC-1’)

###########################################

I do believe that it is an indexing issue and any help on getting a proper plot will be greatly appreciated.

Could you please try with the latest version since there is a fix for streamtube indexing in plotly.js v1.51: https://github.com/plotly/plotly.js/releases/tag/v1.51.0
Thanks!

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online