def draw_cbar(cmap): gradient = np.linspace(0, 1, 256) gradient = np.vstack((gradient, gradient)) fig, ax = plt.subplots() ax.imshow(gradient, aspect=10, cmap=cmap) ax.set_axis_off() plt.show()