MWE:
using GLMakie
xg = range(0, 10; length = 100)
yg = range(0, 10; length = 100)
bsn = rand(1:5, (100, 100))
fig = Figure(resolution = (700,600))
display(fig)
colors = [:black, :blue, :red, :teal, :yellow]
cmap = cgrad(colors, 5; categorical = true)
# cmap = cgrad(COLORSCHEME[1:length(att)]; categorical = true)
ax = fig[1,1] = Axis(fig)
heatob = Observable(bsn[:, :, 1])
hm = heatmap!(ax, xg, yg, heatob; colormap = cmap)
hm.colorrange = (1, 5)
cbar = fig[:, 2] = Colorbar(fig, hm, label = "attractor #")
The question is: how to make the ticks of the colorbar centered exactly at the middle of each color segment. Example: