Consistent colors for 3 px charts (setting color_discrete_map by color_discrete_sequence)?

Hi, I am mapping out multiple manufacturers’ inputs into a process.

For a given manufacturer, there is a dataframe where the column “all_inputs” contains the types of inputs. I then use px to chart changes in input usage.

The problem is that the client wants the colors to be consistent across all of the graphs, and not all of the elements in all_inputs are used in each graph.

Eg
all_inputs for manufacturer 1 = [a,b,c,d,e,f]
Graph 1 uses [a,b,c,e]
Graph 2 uses [b,c,d,f]

I was going to use color_discrete_map for all_inputs, but in practice, all_inputs could include 15 inputs for 1 manufacturer or 50 inputs for another manufacturer.
Eg
all_inputs for manufacturer 1 =[a,b,c,d,e,f,g,h,i,j,k]

Is there a way to set the color_discrete_map by a color_discrete_sequence, so that the colors remain consistent across the px charts and I don’t have to manually choose each color in the map for each input for each manufacturer?

Thanks!

1 Like