I would like my grid of contour plots to refer to the same colorbar, but I get four stacked colorbars on top of each other. How can I have just one colorbar with its numerical values refering to data in all of the plots? Or, in other words, how can my plots' colors refer to the same colorbar?
Here is the test code:
import plotly.graph_objects as go
from plotly.subplots import make_subplots
z1 = [[2, 4, 7, 12, 13, 14, 15, 16],
[3, 1, 6, 11, 12, 13, 16, 17],
[4, 2, 7, 7, 11, 14, 17, 18],
[5, 3, 8, 8, 13, 15, 18, 19],
[7, 4, 10, 9, 16, 18, 20, 19],
[9, 10, 5, 27, 23, 21, 21, 21],
[11, 14, 17, 26, 25, 24, 23, 22]]
z2 = [[20, 44, 7, 120, 1, 1, 5, 16],
[3, 10, 6, 110, 12, 135, 162, 17],
[4, 2, 77, 77, 11, 14, 172, 18],
[54, 34, 8, 8, 13, 1, 1, 19],
[7, 4, 10, 96, 16, 18, 20, 19],
[9, 10, 55, 27, 2, 21, 2, 2],
[11, 1, 17, 26, 2, 24, 23, 22]]
z3 = [[205, 44, 7, 120, 1, 1, 5, 16],
[3, 10, 6, 110, 12, 135, 162, 17],
[4, 2, 77, 77, 11, 144, 172, 18],
[54, 34, 8, 8, 13, 1, 1, 19],
[7, 42, 10, 96, 16, 18, 20, 19],
[9, 10, 55, 27, 2, 25, 2, 2],
[11, 13, 17, 26, 2, 24, 23, 22]]
z4 = [[203, 44, 7, 120, 1, 1, 5, 16],
[3, 10, 6, 110, 126, 135, 162, 17],
[4, 2, 77, 7, 11, 144, 172, 18],
[54, 34, 8, 8, 13, 1, 1, 19],
[7, 42, 10, 96, 16, 18, 20, 19],
[9, 10, 55, 27, 2, 253, 2, 2],
[11, 1, 17, 26, 2, 24, 23, 22]]
figc1=make_subplots(rows=2, cols=2, shared_xaxes=True, shared_yaxes=True, vertical_spacing=0.05, horizontal_spacing=0.05)
figc1.add_trace(go.Contour(z=z1, coloraxis='coloraxis'), row=1, col=1)
figc1.add_trace(go.Contour(z=z2, coloraxis='coloraxis'), row=1, col=2)
figc1.add_trace(go.Contour(z=z3, coloraxis='coloraxis'), row=2, col=1)
figc1.add_trace(go.Contour(z=z4, coloraxis='coloraxis'), row=2, col=2)
figc1.update_layout(coloraxis=dict(colorscale='Viridis'), showlegend=False)
figc1.show()
If you run this code, you will see that the colorbar shows as its maximum the maximum value of z1, and it should show maximum of z1,z2,z3 and z4.