Is it possible for multiple traces to share the same colorscale?

For different traces, even if I assign the same colormap (using a float array as color input), the colorscale will be different because of the different max and min values of each trace. Is there an easy way to plot them with a shared colorscale? I cannot plot them in the same trace because I need to style them differently. Thanks!

Not at the moment unfortunately.

Here’s how:

1 Like

Thanks! This will work for me.

Had the same problem - used something like this:

col_mat_0 = np.array([[0,189,242],[0,45,114]]) #Has the colorscale values corresponding to 0 and 1
col_mat_1 = col_mat_0[0]+np.matmul(np.array(z_data.max(axis=1)).reshape(len(z_data.max(axis=1)),1),
col_mat_0 = col_mat_0[0]+np.matmul(np.array(z_data.min(axis=1)).reshape(len(z_data.max(axis=1)),1),

While using within the traces:

colorscale=[[0.0, ‘rgb(%d,%d,%d)’%(col_mat_0[i][0], col_mat_0[i][1], col_mat_0[i][2])],
[1.0, ‘rgb(%d,%d,%d)’%(col_mat_1[i][0], col_mat_1[i][1], col_mat_1[i][2])]],

You can subscribe to for the most up-to-date development info.