I figured out a way to do it if it helps anyone. Not sure if it’s the best/cleanest way so open to tweaks and adjustments if anyone has done this before.
My real data included dates which is why I have the formatted piece going on.
if warm_selected_data:
selected_x_y_pairs = [(item['x'], item['y']) for item in warm_selected_data['points']]
formatted_x_y_pairs = [(datetime.strptime(x, '%Y-%m-%d %H:%M').strftime('%Y-%m-%dT%H:%M:%S'), y)
for x, y in selected_x_y_pairs]
color_type = warm_plot['data'][0]['legendgroup']
if color_type == 'Included':
excluded_data = warm_plot['data'][1]
else:
excluded_data = warm_plot['data'][0]
excluded_x_y_pairs = list(zip(excluded_data['x'], excluded_data['y']))
values_to_include_in_avg_calc = [pair for pair in formatted_x_y_pairs if pair not in excluded_x_y_pairs]