Search code examples
pythonplotly

Set the range for colorbar of a 3D surface plot created using Plotly


How to manually set the range of the colorbar of 3D surface plot created using Plotly?


Solution

  • The color bar range can be set using cmin and cmax as follows:

    fig = go.Figure(go.Surface(x=x_values,y=y_values,z=z_values,colorscale="Plotly3",cmin=-5,cmax=5))