I draw a scatter chart as below :
The code is :
sc = plt.scatter(x, y, marker='o', s=size_r, c=clr, vmin=lb, vmax=ub, cmap=mycm, alpha=0.65)
cbar = plt.colorbar(sc, shrink=0.9)
And I want to shift the colorbar to right a little bit to extend the drawing area. How to do that ?
Use the pad
attribute.
cbar = plt.colorbar(sc, shrink=0.9, pad = 0.05)
The documentation of make_axes() describes how to use pad
: "pad: 0.05 if vertical, 0.15 if horizontal; fraction of original axes between colorbar and new image axes".