Wie passe ich lange Titel?
Da ist einähnliche Frage - aber ich kann die dort vorgeschlagene Lösung nicht zum Laufen bringen.
Hier ist ein Beispielplot mit einem langen Titel:
<code>#!/usr/bin/env python import matplotlib import matplotlib.pyplot import textwrap x = [1,2,3] y = [4,5,6] # initialization: fig = matplotlib.pyplot.figure(figsize=(8.0, 5.0)) # 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("\n".join(textwrap.wrap(myTitle, 80))) # tight: (matplotlib.pyplot).tight_layout() # saving: fig.savefig("fig.png") </code>
es gibt a
<code> AttributeError: 'module' object has no attribute 'tight_layout' </code>
und wenn ich ersetze(matplotlib.pyplot).tight_layout()
mitfig.tight_layout()
es gibt:
<code> AttributeError: 'Figure' object has no attribute 'tight_layout' </code>
Meine Frage lautet also: Wie passe ich den Titel der Handlung an?