Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Problem on 3dScatter

Hi, i’ve recently encountered a nice problem on a 3D scatter. Basically i have to draw a trajectory in the space. The task is really easy, and the routine is:
def singleTracePlotly(xCoordinates,yCoordinates,zCoordinates,title):
data=[]
computedTrace = go.Scatter3d(
x = xCoordinates,
y = yCoordinates,
z = zCoordinates,
mode = ‘lines’,
line = dict(
width = 2),
marker=dict(
size=0
),
)
data.append(computedTrace)
layout = go.Layout(
showlegend=True,
title=title
)

fig = go.Figure(data=data,layout = layout)
py.plot(fig,filename=title+".html",auto_open=True)

Datas come out from an external application, they are:
yCoordinates
[0]: 0.127
[1]: 0.127
[2]: 0.125978978978979
[3]: 0.12352852852852854
[4]: 0.11842342342342344
[5]: 0.11066366366366368
[6]: 0.10024924924924923
[7]: 0.08697597597597598
[8]: 0.07125225225225224
[9]: 0.05389489489489489
[10]: 0.035720720720720696
[11]: 0.017342342342342325
[12]: -0.0010360360360360532
[13]: -0.019414414414414452
[14]: -0.03758858858858863
[15]: -0.055966966966967
[16]: -0.07434534534534537
[17]: -0.09268742243432825
[18]: -0.10948870991946526
[19]: -0.12158264336617679
[20]: -0.12661527586766336
[21]: -0.127
[22]: -0.127
[23]: -0.127
[24]: -0.127
[25]: -0.127
[26]: -0.127
[27]: -0.127
[28]: -0.12695359063422995
[29]: -0.12395403152378373
[30]: -0.11400403410651283
[31]: -0.09833257395499025
[32]: -0.08019782039459117
[33]: -0.061888888888888896
[34]: -0.04371471471471472
[35]: -0.02533633633633635
[36]: -0.0069579579579579776
[37]: 0.011420420420420414
[38]: 0.02959459459459459
[39]: 0.047972972972972955
[40]: 0.06573873873873873
[41]: 0.08207507507507507
[42]: 0.09596096096096095
[43]: 0.10739639639639639
[44]: 0.11597297297297299
[45]: 0.12189489489489491
[46]: 0.12536636636636633
[47]: 0.1267957957957958

zCoordinates
[0]: 0.28
[1]: 0.28
[2]: 0.28
[3]: 0.2800000000000001
[4]: 0.28
[5]: 0.28
[6]: 0.28
[7]: 0.28
[8]: 0.28
[9]: 0.28
[10]: 0.28
[11]: 0.28
[12]: 0.28
[13]: 0.28
[14]: 0.28
[15]: 0.28
[16]: 0.28
[17]: 0.2790030702964421
[18]: 0.27223206356884594
[19]: 0.25864842776076136
[20]: 0.24122354414339464
[21]: 0.22297297297297297
[22]: 0.20462462462462466
[23]: 0.1862762762762763
[24]: 0.16792792792792796
[25]: 0.1495795795795796
[26]: 0.13123123123123126
[27]: 0.11301301301301304
[28]: 0.09458806924381429
[29]: 0.07665180004596833
[30]: 0.0614308867458067
[31]: 0.05236526284198173
[32]: 0.05000985053593647
[33]: 0.05000000000000001
[34]: 0.05000000000000001
[35]: 0.05000000000000001
[36]: 0.05000000000000001
[37]: 0.05
[38]: 0.05
[39]: 0.05
[40]: 0.05
[41]: 0.05
[42]: 0.05000000000000001
[43]: 0.05
[44]: 0.05
[45]: 0.05
[46]: 0.05
[47]: 0.05

xCoordinates
[0]: -0.078
[1]: -0.078
[2]: -0.078
[3]: -0.078
[4]: -0.078
[5]: -0.078
[6]: -0.07799999999999999
[7]: -0.078
[8]: -0.07800000000000001
[9]: -0.07800000000000001
[10]: -0.078
[11]: -0.078
[12]: -0.078
[13]: -0.078
[14]: -0.07800000000000001
[15]: -0.07800000000000001
[16]: -0.07799999999999999
[17]: -0.078
[18]: -0.07799999999999997
[19]: -0.078
[20]: -0.078
[21]: -0.078
[22]: -0.078
[23]: -0.078
[24]: -0.078
[25]: -0.078
[26]: -0.078
[27]: -0.078
[28]: -0.07800000000000003
[29]: -0.07799999999999997
[30]: -0.07799999999999999
[31]: -0.07800000000000001
[32]: -0.078
[33]: -0.07800000000000001
[34]: -0.078
[35]: -0.078
[36]: -0.078
[37]: -0.078
[38]: -0.078
[39]: -0.078
[40]: -0.078
[41]: -0.078
[42]: -0.078
[43]: -0.078
[44]: -0.078
[45]: -0.078
[46]: -0.078
[47]: -0.078

The routine turns out a blank plot where i can’t see neither the line neither the axis and the layout.
However, if i define xCoordinates= np.linspace(-0.078,-0.078,len(xCoordinates)) then everything works.

@dbarchi
x, y, respectively z-coords should be: lists, 1d numpy arrays or pandas dataframes (series). Did you pass them in one of this forms?

Yes, they are all lists