Reputation: 73
Experimenting with go.Scatter3d I noticed the option marker sizemode="diameter". It seems that this option is not related to the diameter of the markers in input space.
Is it possible to resize the marker with custom diameter in input space?
E.g. I want markers, each with a diameter of 5 in terms of the input space:
import plotly.express as px
import plotly.graph_objects as go
import numpy as np
x =y=z = np.arange(1,4)
fig = go.Figure()
fig.add_trace(
go.Scatter3d(
mode='markers',
x=x,
y=y,
z=z,
marker=dict(
color=px.colors.qualitative.D3,
size=5,
sizemode='diameter'
)
)
)
axis_range = [-5,10]
fig.update_layout(scene = dict(
xaxis = dict(range=axis_range,),
yaxis = dict(range=axis_range,),
zaxis = dict(range=axis_range,)
))
fig.show()
Upvotes: 0
Views: 4308
Reputation: 1052
Dont' really understand your question, what you'd like to achive, but the docs: https://plot.ly/python/reference/#scatter3d are saying that the sizemode will only have an effect if marker.size
is set to a numerical array.
So, based on your example:
import plotly.express as px
import plotly.graph_objects as go
import numpy as np
x =y=z = np.arange(1,4)
fig = go.Figure()
fig.add_trace(
go.Scatter3d(
mode='markers',
x=x,
y=y,
z=z,
marker=dict(
color=px.colors.qualitative.D3,
size=[5, 10, 30],
sizemode='diameter'
)
)
)
axis_range = [-5,10]
fig.update_layout(scene = dict(
xaxis = dict(range=axis_range,),
yaxis = dict(range=axis_range,),
zaxis = dict(range=axis_range,)
))
fig.show()
Upvotes: 1