'How to get Slider in Plotly to show each value of r instead of the steps?
fig = go.Figure()
for r in np.arange(0.05, 0.56, 0.005): #want the steps to show each value in r
xth_r,yth_r,zth_r = coords_theta(r)
fig.add_trace(
go.Scatter(mode="lines",
line=dict(color="#00CED1", width=2.5),
x=th,
y=magB(xth_r,yth_r,zth_r,xpos,ypos,zpos,0.1*165)))
fig.data[10].visible = True
steps = []
for i in range(len(fig.data)):
step = dict(
method="update",
args=[{"visible": [False] * len(fig.data)},
{"title": "R(m) is :" + str(i)}],
)
step["args"][0]["visible"][i] = True
steps.append(step)
sliders = [dict(
active=10,
currentvalue={"prefix": "R: "},
pad={"t": 50},
steps=steps
)]
fig.update_layout(
sliders=sliders
)
fig.show()
The steps show up as integer values, like step-0, step-6. I don't want this, I just want them to be the values in r. I would also like to have the area underneath the slider contain maybe like every 5 values of r, such that it doesn't get overcrowded with numbers.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|