Plotly Express: Legend Grouping

Hi,

Is there a way to define legend groups with plotly express?

import pandas as pd
import numpy as np
import plotly.express as px

df = pd.DataFrame({'time': np.tile(np.arange(10),2), 'price': np.random.randint(100,200,20), 'group': np.repeat(['a','b'],10)})
df['is_prediction'] = df.time >= 8

px.line(df, x="time", y="price", color="group", line_dash="is_prediction")


Here, I would like the color and line_dash to have separate legends instead of being clubbed together. So the legend should look something like:

Group
[*blue*] a
[*red*] b

Is Prediction
- False
-- True

Thanks in advance.

Unfortunately there’s not really any way to do this at this time.