There\'s a similar question - but I can\'t make the solution proposed there work.
Here\'s an example plot with a long title:
#!/usr/bin/env python
i
matplotlib version 3.1.2 documentationplt.savefig(...) seems to work properly with wrapimport matplotlib.pyplot as plt
x = [1,2,3]
y = [4,5,6]
# initialization:
fig, axes = plt.subplots(figsize=(8.0, 5.0))
# title:
myTitle = "Some really really long long long title I really really need - and just can't - just can't - make it any - simply any - shorter - at all."
# lines:
axes.plot(x, y)
# set title
axes.set_title(myTitle, loc='center', wrap=True)
plt.show()
plt.figure(figsize=(8, 5))
# title:
myTitle = "Some really really long long long title I really really need - and just can't - just can't - make it any - simply any - shorter - at all."
# lines:
plt.plot(x, y)
# set title
plt.title(myTitle, loc='center', wrap=True)
plt.show()
# lines:
fig.add_subplot(111).plot(x, y)
# title:
myTitle = "Some really really long long long title I really really need - and just can't - just can't - make it any - simply any - shorter - at all."
fig.add_subplot(111).set_title(myTitle, loc='center', wrap=True)
MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance. In a future version, a new instance will always be created and returned. Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.