Increase distance between title and plot in matplolib? [duplicate]

Solution 1:

With matplotlib 2.2+, you can use the keyword argument pad:

ax.set_title('Title', pad=20)

Adjust pad until you're happy with the axis title position. The advantage of this method over using rcParams is that it only changes this one axis title.

Solution 2:

There doesn't seem to be a clean way to set this directly (but might be worth a feature request to add that), however the title is just a text artist, so you can reach in and change it.

#ax = plt.gca()
ttl = ax.title
ttl.set_position([.5, 1.05])
#plt.draw()

should do the trick. Tune the 1.05 to your liking.