I have created a two line plot chart with Plotly and when showlegend=True, the name of the variables are Trace 0 and Trace 1. How can I change manually the name of these variables?
I show below the code and the output.
# add line / trace 1 to fig_linee2
fig_linee2 = go.Figure()
fig_linee2.add_trace(go.Scatter(
x=Deaths_wihing_28_days2["date"],
y=Deaths_wihing_28_days2['newDeaths28DaysByDeathDate'],
marker=dict(
color="blue"
),
showlegend=True
))
# add line / trace 2 to fig_linee2
fig_linee2.add_trace(go.Scatter(
x=patients_adm2["date"],
y=patients_adm2["newAdmissions"],
marker=dict(
color="green"
),
showlegend=True))
fig_linee2.update_layout(
height=400,
title=dict(
text='<b>Death people and admitted by COVID</b>',
x=0.5,
y=0.95,
font=dict(
family="Arial",
size=20,
color='#000000'
)
),
xaxis_title="<b>Selected date</b>",
yaxis_title='<b>Number of people</b>',
font=dict(
family="Courier New, Monospace",
size=12,
color='#000000'),
)