Skip to content

Commit 0402d00

Browse files
committed
wip streamtube
1 parent 2617797 commit 0402d00

File tree

1 file changed

+60
-3
lines changed

1 file changed

+60
-3
lines changed

python/streamtube-plot.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,40 @@ fig.update_layout(
8181
fig.show()
8282
```
8383

84+
```python
85+
import plotly.graph_objects as go
86+
87+
fig = go.Figure(data=go.Streamtube(x=[0, 0, 0], y=[0, 1, 2], z=[0, 0, 0], u=[0, 0, 0], v=[1, 2, 3], w=[0, 0, 0]))
88+
fig.show()
89+
```
90+
91+
```python
92+
import plotly.graph_objects as go
93+
94+
fig = go.Figure(data=go.Streamtube(x=[0, 1, 2], y=[0, 0, 0], z=[0, 0, 0], u=[1, 2, 3], v=[0, 0, 0], w=[0, 0, 0],
95+
starts=dict(x=[0],
96+
y=[0],
97+
z=[0],)))
98+
fig.show()
99+
```
100+
101+
```python
102+
import plotly.graph_objects as go
103+
104+
fig = go.Figure(data=go.Streamtube(x=[0, 0, 0], y=[0, 0, 0], z=[0, 1, 2], u=[0, 0, 0], v=[0, 0, 0], w=[1, 2, 3],
105+
starts=dict(x=[0],
106+
y=[0],
107+
z=[0],)))
108+
fig.show()
109+
```
110+
84111
```python
85112
import numpy as np
86113
import plotly.graph_objects as go
87114

88115
x, y, z = np.mgrid[1:4:10j, 1:4:10j, 1:4:10j]
89-
u = 0.0001 * x**2
90-
v = 0.005 * np.random.random(y.shape)
116+
u = 0.001 * x
117+
v = 0.001 * y
91118
w = 0.1 * z
92119

93120
sx=np.linspace(1, 4, 10, endpoint=True)
@@ -105,7 +132,37 @@ fig = go.Figure(data=go.Streamtube(
105132
starts=dict(x=sx.flatten(),
106133
y=sy.flatten(),
107134
z=sz.flatten()),
108-
hovertext='w',
135+
hoverinfo='x+y+z+u+v+w+norm',
136+
#sizeref=0.3
137+
))
138+
fig.show()
139+
```
140+
141+
```python
142+
import numpy as np
143+
import plotly.graph_objects as go
144+
145+
x, y, z = np.mgrid[1:4:10j, 1:4:10j, 1:4:10j]
146+
u = 0.000 * x**2
147+
v = 0.00 * np.random.random(y.shape)
148+
w = 0.1 * y
149+
150+
sx=np.linspace(1, 4, 10, endpoint=True)
151+
sx, sy=np.meshgrid(sx, sx)
152+
sz=np.ones(sx.shape)
153+
154+
155+
fig = go.Figure(data=go.Streamtube(
156+
x=x.ravel(),
157+
y=y.ravel(),
158+
z=z.ravel(),
159+
u=u.ravel(),
160+
v=v.ravel(),
161+
w=w.ravel(),
162+
starts=dict(x=sx.flatten(),
163+
y=sy.flatten(),
164+
z=sz.flatten()),
165+
hoverinfo='x+y+z+u+v+w+norm',
109166
sizeref=0.3
110167
))
111168
fig.show()

0 commit comments

Comments
 (0)