df:
id timestamp data Date Start
timestamp
2020-01-15 06:12:49.213 40250 2020-01-15 06:12:49.213 20.0 2020-01-15 NaN
2020-01-15 06:12:49.313 40251 2020-01-15 06:12:49.313 19.5 2020-01-15 0.0
2020-01-15 08:05:10.083 40256 2020-01-15 08:05:10.083 20.0 2020-01-15 1.0
2020-01-15 08:05:10.183 40257 2020-01-15 08:05:10.183 20.5 2020-01-15 0.0
2020-01-15 09:01:50.993 40310 2020-01-15 09:01:50.993 21.0 2020-01-15 0.0
2020-01-15 09:01:51.093 40311 2020-01-15 09:01:51.093 21.5 2020-01-15 0.0
2020-01-15 09:51:01.890 40336 2020-01-15 09:51:01.890 22.0 2020-01-15 0.0
I want to plot an interactive graph using plotly.express, colour by Start(which is dummy variable), with mode='lines+markers'. But I couldn't add the line. At the moment, using code below
import plotly.express as px
fig = px.line(df, x="timestamp", y="data", title='xxx')
fig = px.scatter(df, x="timestamp", y="data",color='Start')
fig.show()
Update:
Tried:
import plotly.express as px
fig = px.line(x=df['timestamp'], y=df['data'])
fig.add_scatter(x=df['timestamp'], y=df['data'], marker_color=df['Start'])


