To your second question: you can use a negative labelpad
value to move the label back towards the ticklabels, like this:
import numpy as np
import matplotlib.pyplot as plt
data = np.linspace(0, 10, num=256).reshape(16,16)
cf = plt.contourf(data, levels=(0, 2.5, 5, 7.5, 10))
cb = plt.colorbar(cf)
cb.set_ticklabels([r'$<10^{0}$', 1, 2, r'$10^{14}$', r'$10^{14}+12345678$'])
cb.set_label(r'$n_e$ in $m^{-3}$', labelpad=-40, y=0.45)
plt.show()
Using the parameter y
, you can additionally move the label up or down for better symmetry.
The argument of labelpad
is given in points (1/72 inch). y
accepts values in [0, 1]
, 0.0
is the lower border and 1.0
the upper.
The result: