I am trying to create a line charts with text labels on the chart itself but it is not working. It is working perfectly fine in scatter plot with the text parameter which you can see below.
code -
import plotly.express as px
fig = px.scatter(crime2,
x='murder',
y='burglary',
size='population',
text='state') # add figure label
fig.update_layout(xaxis_title='Murder Rate',
yaxis_title='Burglary Rate')
fig.update_traces(marker=dict(color='red'))
fig.show()
But it's not working with line chart. code for line chart -
fig = px.line(covid_subset,
x='date',
y='total_cases',
color='location',
text='location'
)
fig.update_layout(title='Cumulative Confirmed covid-19 cases')
fig.show()
As you can see instead of show the country label on the line chart only at one place it kept showing all over the line.
I might missing some parameter but I don't know what is it.
This is what I am trying to do -