How to plot a scatter plot and line plot in one figure and setting a column as the color?

Ahh, you have to convert True/False to a numerical value like so:

import plotly.express as px
import pandas as pd
import random

# create data
days=7
timespan = pd.date_range('01/01/2022', periods=days, freq='D')
value = [np.random.randint(1,50) for _ in range(days)]
color = [np.random.randint(1,50) for _ in range(days)]
value2 = [[True, False][np.random.randint(0,2)] for _ in range(days)]
value2 = [1 if val else 0 for val in value2]

# create figure
fig = px.scatter(x=timespan, y=value, color=color)
fig.add_scatter(x=timespan, y=value2, mode='markers+lines',marker={'size':30}, showlegend=False)
fig.show()
1 Like