Вы можете использовать graph_objs.Scatter3d
:
import pandas as pd
import plotly.graph_objs as go
df = pd.DataFrame({'X': [1,2,3,4,5,],
'Y': [1,3,2,4,1],
'Z': [4,1,3,4,1],
'R': [252, 11, 250, 21, 8],
'G': [1, 127, 251, 25, 244],
'B': [1, 28, 8, 128, 4]})
trace = go.Scatter3d(x=df.X,
y=df.Y,
z=df.Z,
mode='markers',
marker=dict(size=5,
color=['rgb({},{},{})'.format(r,g,b) for r,g,b in zip(df.R.values, df.G.values, df.B.values)],
opacity=0.9,))
data = [trace]
layout = go.Layout(margin=dict(l=0,
r=0,
b=0,
t=0))
fig = go.Figure(data=data, layout=layout)
fig.show()
, и вы получите: