I have a Plotly chart with a colourbar legend.
I'd like this to go from 0 to 100 with the ticks set every 10.
No matter how I try, the chart always starts the ticks at 10 and ends at 90, removing my top and bottom tick.
How can I ensure that the top and bottom tick are shown?
MWE:
import numpy as np
import plotly.graph_objects as go
x = np.linspace(0, 1, 50)
y = np.linspace(0, 1, 50)
xx, yy = np.meshgrid(x, y)
z = 100*xx*yy
figure = go.Figure()
figure.add_trace(
go.Contour(
z=z.flatten(),
x=xx.flatten(),
y=yy.flatten(),
zmin=0,
zmax=100,
colorbar_tickvals=np.arange(0, 101, 10),
colorbar_tickmode='array',
)
)
figure.update_layout(
template="simple_white",
)
figure.show()
from Plotly colourbar legend not showing max or min value
No comments:
Post a Comment