Hi guys ! I would like to know if someone know how can I display lineplots using a dropdown menu. I basically ran the code bellow and it produces a scatter plot for the line part. Thank you !
import plotly.graph_objects as px
import pandas as pd
reading the database
data = pd.read_csv(“tips.csv”)
plot = px.Figure(data=[px.Scatter(
x=data[‘day’],
y=data[‘tip’],
mode=‘markers’,)
])
Add dropdown
plot.update_layout(
updatemenus=[
dict(
buttons=list([
dict(
args=[“type”, “scatter”],
label=“Scatter Plot”,
method=“restyle”
),
dict(
args=[“type”, “bar”],
label=“Bar Chart”,
method=“restyle”
),
dict(
args=[“type”, “line”],
label=“Line Plot”,
method=“restyle”
),
dict(args = [“type”, “box”],
label = “Box”,
method = “restyle”
),
dict(args = [“type”, “violin”],
label = “Violin”,
method = “restyle”
)
]),
direction=“down”,
),
]
)
plot.show()