Кажется, вы просите BoundaryNorm
.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors
cmap = matplotlib.colors.ListedColormap(["limegreen", "gold", "crimson"])
norm = matplotlib.colors.BoundaryNorm([0,10,50,55], 3)
x = np.linspace(0,55)
fig, (ax, ax2) = plt.subplots(ncols=2)
sc = ax.scatter(x,x, c=x, cmap=cmap, norm=norm)
fig.colorbar(sc, ax=ax, spacing="uniform")
sc2 = ax2.scatter(x,x, c=x, cmap=cmap, norm=norm)
fig.colorbar(sc2, ax=ax2, spacing="proportional")
plt.show()
