Hi everyone! I want to change Scatter3D plot color but it seems plot_bgcolor doesnโt work
Am I doing something wrong, or is there any workaround you can suggest to help me, fix this? Any help is highly appreciated.
import plotly.offline as ply
import plotly.graph_objects as go
x, y, z = np.random.normal(0, 1, 10000), np.random.normal(0, 1, 10000), np.random.normal(0, 1, 10000)
fig = go.Figure()
fig.add_trace(go.Scatter3d(x=x, y=y, z=z,
mode='markers',
marker=dict(size=1, color='olive'),
name='X-Y-Z distribution',
)
)
fig.add_trace(go.Scatter3d(x=x, y=y, z=np.ones(len(z)) * z.min() * 2,
mode='markers',
marker=dict(size=1, color='red'),
name='X-Y distribution',
hovertemplate='x:%{x:.2f}' +
'<br>y:%{y:.2f}<br>'
)
)
fig.add_trace(go.Scatter3d(x=np.ones(len(x)) * x.min() * 2, y=y, z=z,
mode='markers',
marker=dict(size=1, color='green'),
name='Y-Z distribution',
hovertemplate='y:%{y:.2f}' +
'<br>z:%{z:.2f}<br>'
)
)
fig.add_trace(go.Scatter3d(x=x, y=np.ones(len(y)) * min(y) * 2, z=z,
mode='markers',
marker=dict(size=1, color='blue'),
name='X-Z distribution',
hovertemplate='x:%{x:.2f}' +
'<br>z:%{z:.2f}<br>'
)
)
fig.update_layout(scene=dict(xaxis=dict(range=[-10, 10], showgrid=True, gridwidth=1, gridcolor='LightPink'),
yaxis=dict(range=[-10, 10]),
zaxis=dict(range=[-10, 10])),
plot_bgcolor='rgb(12,163,135)',
)
ply.plot(fig)