I am using plotly
and python
to visualize 3D data and I encoutered a strange phenomenon when plotting some data. The following code visualizes data of the form (3,20)
each for the direction x,y and z.
import numpy as np
import plotly.io as pio
import plotly.graph_objects as go
data = np.array([
[4.41568822e+05, 4.41568474e+05, 4.41567958e+05, 4.41567603e+05,
4.41567249e+05, 4.41566952e+05, 4.41566619e+05, 4.41566324e+05,
4.41566021e+05, 4.41565737e+05, 4.41565435e+05, 4.41565098e+05,
4.41564807e+05, 4.41564472e+05, 4.41564121e+05, 4.41563860e+05,
4.41563538e+05, 4.41563226e+05, 4.41562933e+05, 4.41562641e+05],
[5.71148897e+06, 5.71148909e+06, 5.71148928e+06, 5.71148942e+06,
5.71148955e+06, 5.71148967e+06, 5.71148981e+06, 5.71148993e+06,
5.71149006e+06, 5.71149019e+06, 5.71149032e+06, 5.71149047e+06,
5.71149060e+06, 5.71149076e+06, 5.71149093e+06, 5.71149106e+06,
5.71149122e+06, 5.71149137e+06, 5.71149153e+06, 5.71149168e+06],
[1.86559470e+02, 1.86547226e+02, 1.86529120e+02, 1.86516642e+02,
1.86504156e+02, 1.86493615e+02, 1.86481706e+02, 1.86471064e+02,
1.86460026e+02, 1.86449593e+02, 1.86438417e+02, 1.86425803e+02,
1.86414828e+02, 1.86402073e+02, 1.86388572e+02, 1.86378511e+02,
1.86366018e+02, 1.86353893e+02, 1.86342497e+02, 1.86331154e+02]])
fig = go.Figure(data=[go.Scatter3d(x=data[0,:], y=data[1,:], z=data[2,:],
mode='markers',
marker=dict(size=3),
)])
pio.show(fig, renderer='browser')
I have compared the result (top) below with a matplotlib plot of the same data (bottom).


The points that represent a relatively straight line are represented in Plotly in steps rather than in a line, and I don't really understand why.
Can someone explain to me why the points are displayed like this in plotly and how I can fix this problem? I appreciate any help I can get!