Open archmoj opened 4 years ago
For regular scatter this is intentional - bubble charts, which we define to be any chart with marker size set to an array - get some default transparency because overlap is common with large markers. I imagine we simply inherited that same behavior in scatter3d, so I might consider this a documentation issue rather than a bug.
@alexcjohnson thanks for the clarification. This is still rather confusing. With different marker sizes, how one could force a graph not to have any transparency?
marker.opacity = 1 ?
marker.opacity = 1 ?
That works for me!
There is more than that happening:
Single size value:
Array of (same) size values:
Code to reproduce:
import numpy as np
import plotly.graph_objects as go
fig = go.Figure(layout=dict(template='plotly_dark',
scene=dict(xaxis=dict(visible=False),
yaxis=dict(visible=False),
zaxis=dict(visible=False))))
loc = np.array([[0, 0, 0], [1, 0, 0], [2, 0, 0], [3, 0, 0]])
trace = go.Scatter3d(x=loc[:, 0], y=loc[:, 1], z=loc[:, 2], mode='markers',
marker=dict(color=np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [1, 1, 1]]),
# size=[50, 50, 50, 50], # uncomment for use with array
# opacity=1, # uncomment for use with array
# size=50 # uncomment for use with single value
))
fig.add_trace(trace)
fig.show()
If not a bug, I would still argue this to be a serious design flaw (of an otherwise great library!)
From trying out different values, it seems that size is interpreted as the radius if a single value is given and as the diameter if an array is given.
The border can be turned off by explicitly specifying line=dict(width=0)
in the marker
dict.
Transparency appears to be enabled by having different
marker.size
s! View from our docs: