I am try to plot streamlines from a vector field we measured. As you can see in the 3D Scatter Plot and in the 3D Cone Plot it is a dipole field. I am puzzled, because the Plotly streamline plot will not show anything.
My Attempt
-
Download the data here: Data
-
Apply the following code:
df = pd.read_csv('dipole_field_edited.csv')
######## 3D Scatter Plot ########
fig = px.scatter_3d(df,
x='x',
y='y',
z='z',
color='Mod',
size='Mod',
size_max=20)
fig.show()
######## 3D Cone Plot ########
fig = go.Figure(data = go.Cone(
x=df['x'],
y=df['y'],
z=df['z'],
u=df['V_x'],
v=df['V_y'],
w=df['V_z'],
sizeref=10))
fig.update_layout(scene=dict(aspectratio=dict(x=1, y=1, z=0.8),
camera_eye=dict(x=1.2, y=1.2, z=0.6)))
fig.show()
######## 3D Streamtube Plot ########
fig = go.Figure(data=go.Streamtube(
x = df['x'],
y = df['y'],
z = df['z'],
u = df['V_x'],
v = df['V_y'],
w = df['V_z'],
sizeref = 5.0,
colorscale = 'Portland',
maxdisplayed = 3000
))
fig.update_layout(
scene = dict(
aspectratio = dict(
x = 1,
y = 1,
z = 1
)
),
margin = dict(
t = 20,
b = 20,
l = 20,
r = 20
)
)
fig.show()
It seems that Plotly Streamtube does not even see the vectors and their distribution.
I also tried to specify the starting positions, without any help
starts = dict(
x = [490] * len(Y),
y = Y,
z = [240] * len(Y)
),
with
Y=[280.0, 280.0, 280.0, 290.0, 300.0, 310.0, 320.0, 330.0, 350.0, 360.0, 380.0, 390.0, 410.0, 420.0, 430.0, 450.0, 460.0, 480.0, 490.0, 520.0, 550.0, 560.0, 580.0, 620.0, 640.0, 650.0, 690.0, 700.0, 710.0, 720.0, 720.0]
But without any success. Can anybody help?