Hi!
I am trying to enable a dropdown with a view of a graph object table and a scatter plot. I am trying to do that with updatemenus, but the first render of the graph always have both plots.
Is there a way to fix this that I am not aware of?
Here is my example:
import plotly.graph_objects as go
values = ['A Scores', 'B Scores']
x = [100, 90, 80, 90]
y = [95, 85, 75, 95]
table = go.Table(
header=dict(values=values),
cells=dict(values=[x,y])
)
scatter = go.Scatter(x=x,y=y,mode='markers')
fig = go.Figure(data=[scatter,table])
# Add dropdown
fig.update_layout(
updatemenus=[
dict(
active=0,
buttons=list([
dict(
args=["type", "scatter"],
label="Scatter",
method="restyle"
),
dict(
args=["type", "table"],
label="Table",
method="restyle"
)
]),
showactive=True,
),
]
)
fig.show()