Continuous color scale across multiple traces or toggle points in a continuous trace

Is it possible to have a continuous color scale across two or more discrete legend entries? I have two columns in my data frame in addition to x and y, one is hour of the day, and the other is a category describing the hour of the day e.g. night, morning, mid-day, afternoon etc. A specific category name maps to certain hours of the day.

I am able to create a continuous color scale across all hours of the day using a single trace but I want to be able to toggle various combinations of categories - for this I need a discrete legend based on category i.e. separate traces. So, how do I retain the continuous color scale across all hours of the day while having buttons/legend that let me select which group of traces (categories) to display?

For example, I would use code like this to generate a discrete legend entries, where Sequence is the category describing the time of day:

    fig1 = go.Figure()
    for sequence, group in df_profiles.groupby('Sequence'):
        fig1.add_trace(go.Scatter(x=group['X'], y=group['Y'], name=sequence, mode='markers', 
                                    hovertemplate='Breakpoint={sequence}<br>X=%{{x}}<br>Y=%{{y}}<br>Hour=%{{marker.color}}<extra></extra>'.format(sequence=sequence),
                                    marker={'colorscale': "Viridis", 'symbol': 'circle'}
                                    )
                        )

And this to generate a continuous color scale across all discrete points:

fig = px.scatter(df_mvar_profiles, x='X', y='Y',  trendline='ols', 
          template='simple_white', color='Hour of Day', color_continuous_scale=px.colors.cyclical.Edge,
          animation_frame='Month')