Mit, sagen wir, 3 Zeilen Subplots in Matplotlib, xlabels
einer Zeile kann den Titel des nächsten überlappen. Man muss mit pl.subplots_adjust(hspace)
herumspielen, was nervig ist.Matplotlib subplots_adjust hspace so überlappen Titel und xlabels nicht?
Gibt es ein Rezept für hspace
, das Überschneidungen verhindert und funktioniert für jede nrow?
""" matplotlib xlabels overlap titles ? """
import sys
import numpy as np
import pylab as pl
nrow = 3
hspace = .4 # of plot height, titles and xlabels both fall within this ??
exec "\n".join(sys.argv[1:]) # nrow= ...
y = np.arange(10)
pl.subplots_adjust(hspace=hspace)
for jrow in range(1, nrow+1):
pl.subplot(nrow, 1, jrow)
pl.plot(y**jrow)
pl.title(5 * ("title %d " % jrow))
pl.xlabel(5 * ("xlabel %d " % jrow))
pl.show()
Meine Versionen:
- matplotlib 0.99.1.1,
- Python 2.6.4,
- Mac OSX 10.4.11,
- Backend:
Qt4Agg
(TkAgg
=> Ausnahme in Tkinter Rückruf)
(Für viele Extrapunkte, kann jemand umreißen, wie matplotlib packer/spacer arbeitet, entlang der Linien von Kapitel 17 "der Packer" in der Tcl/Tk Buch?)
Sie wollen wahrscheinlich einen Fehler/Wunschliste Eintrag für diese auf dem matplotlib Bugtracker http://sourceforge.net/tracker/?group_id=80706 –
Haben Sie versucht, 'pl Datei. Tight_layout() 'vor' pl.show() 'für eine" automatische "Lösung? – Sebastian
@Sebastian Raschka, "UserWarning: tight_layout: zurück zum Aggendarender", matplotlib 1.4.3 auf einem Mac. (Die Frage war vor 5 Jahren.) – denis