how to change color bar range in go.Surface plot

Viewed 240

I need to have the same color bar range for several plots but can not overcome the auto adjust function.

fig = go.Figure(data=[go.Surface(z=display_data.T)])
title_name = ('Sample title')

fig.update_layout(title=title_name, title_font_size=20, autosize=False,
                          width=1200, height=900,
                          margin=dict(l=50, r=50, b=50, t=50), 
                          
                          )

fig.update_layout(scene_camera_eye=dict(x=4, y=-0.01, z=17),
                          scene_aspectmode='manual', 
                          scene_aspectratio=dict(x=9, y=12, z=10),
                          scene = dict(xaxis = dict(nticks=10, range=[0,342],),
                                       yaxis = dict(nticks=10, range=[0,448],),
                                       zaxis = dict(nticks=10, range=[0,5],),),)


fig.show()

several things does not change anything at my figure.

fig.update_layout(coloraxes = dict(
                                cauto=False, 
                                cmin=-5, 
                                cmax=5)
                         )

or

fig.update_layout(coloraxis = dict(colorscale='balance', colorbar_len=0.7),)

enter image description here

the range of the color bar should be [0 5] but all values are much smaller than 5, that is why the upper limit is just 3.5+ Help would be much appreciated. cheers

0 Answers
Related