Add a vertical label to matplotlib colormap legend
问题 This code enables me to plot a colormap of a "3d" array [X,Y,Z] (they are 3 simple np.array of elements). But I can't succeed in adding a vertical written label at the right of the colorbar legend. import numpy as np import matplotlib.pyplot as plt fig = plt.figure("Color MAP 2D+") contour = plt.tricontourf(X, Y, Z, 100, cmap="bwr") plt.xlabel("X") plt.ylabel("Y") plt.title("Color MAP 2D+") #Legend def fmt(x, pos): a, b = '{:.2e}'.format(x).split('e') b = int(b) return r'${} \times 10^{{{}}}$