def palplot(pal, size=1):
 n = len(pal)
 (f, ax) = plt.subplots(1, 1, figsize=((n * size), size))
 ax.imshow(np.arange(n).reshape(1, n), cmap=mpl.colors.ListedColormap(list(pal)), interpolation='nearest', aspect='auto')
 ax.set_xticks((np.arange(n) - 0.5))
 ax.set_yticks([(-0.5), 0.5])
 ax.set_xticklabels([])
 ax.set_yticklabels([])

def palplot ( pal , size = 1 ) : n = len ( pal ) ( f , ax ) = plt . subplots ( 1 , 1 , figsize = ( ( n * size ) , size ) ) ax . imshow ( np . arange ( n ) . reshape ( 1 , n ) , cmap = mpl . colors . ListedColormap ( list ( pal ) ) , interpolation = 'nearest' , aspect = 'auto' ) ax . set_xticks ( ( np . arange ( n ) - 0.5 ) ) ax . set_yticks ( [ ( - 0.5 ) , 0.5 ] ) ax . set_xticklabels ( [ ] ) ax . set_yticklabels ( [ ] )
plot the values in a color palette as a horizontal array .