SOLVED - see comment below on combining wraptext.wrap
and plt.tightlayout
.
PROBLEM: Here\'s the code:
import matplotlib.pyp
You could wrap the text with newline characters (\n
) automatically using textwrap:
>>> longstring = "this is a very long title and therefore it gets cropped which is an unthinkable behaviour as it loses the information in the title"
>>> "\n".join(textwrap.wrap(longstring, 100))
'this is a very long title and therefore it gets cropped which is an unthinkable behaviour as it\nloses the information in the title'
In this case, 100
is the number of characters per line (to the nearest whitespace - textwrap tries not to break up words)
Another option is to reduce the size of the font:
matplotlib.rcParams.update({'font.size': 12})