スキャッターのノーマライザーとしてBoundaryNormを使用すると、カスタムの個別のカラーバーを非常に簡単に作成できます。(私の方法では)風変わりなビットが0を灰色で表示しています。
画像の場合、私はよくcmap.set_bad()を使用して、データをnumpyのマスクされた配列に変換します。0を灰色にするのははるかに簡単ですが、スキャッターまたはカスタムcmapでこれを機能させることはできませんでした。
別の方法として、独自のcmapを最初から作成するか、既存のcmapを読み取り、特定のエントリのみをオーバーライドすることができます。
import numpy as np
import matplotlib as mpl
import matplotlib.pylab as plt
fig, ax = plt.subplots(1, 1, figsize=(6, 6)) # setup the plot
x = np.random.rand(20) # define the data
y = np.random.rand(20) # define the data
tag = np.random.randint(0, 20, 20)
tag[10:12] = 0 # make sure there are some 0 values to show up as grey
cmap = plt.cm.jet # define the colormap
# extract all colors from the .jet map
cmaplist = [cmap(i) for i in range(cmap.N)]
# force the first color entry to be grey
cmaplist[0] = (.5, .5, .5, 1.0)
# create the new map
cmap = mpl.colors.LinearSegmentedColormap.from_list(
'Custom cmap', cmaplist, cmap.N)
# define the bins and normalize
bounds = np.linspace(0, 20, 21)
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
# make the scatter
scat = ax.scatter(x, y, c=tag, s=np.random.randint(100, 500, 20),
cmap=cmap, norm=norm)
# create a second axes for the colorbar
ax2 = fig.add_axes([0.95, 0.1, 0.03, 0.8])
cb = plt.colorbar.ColorbarBase(ax2, cmap=cmap, norm=norm,
spacing='proportional', ticks=bounds, boundaries=bounds, format='%1i')
ax.set_title('Well defined discrete colors')
ax2.set_ylabel('Very custom cbar [-]', size=12)

個人的には20色で具体的な値がわかりにくいと思いますが、もちろんそれはあなた次第です。