2017-06-28 3 views
0

Ich habe stem_graphic verwendet, um einen Stamm und Blatt Plot zu plotten und es in pdf gespeichert, aber beim Versuch, title Titel geben geben Fehler: Figure object have no attribute set_title.Abbildung Objekt haben kein Attribut set_title

ax, b=stem_graphic(mileage['disp']) 
ax.set_title("Vicky") 


This is the error 
Traceback (most recent call last): 
File "<pyshell#214>", line 1, in <module> 
ax.set_title("Vicky") 
AttributeError: 'Figure' object has no attribute 'set_title' 

Antwort

0

Es sieht aus wie Ihre stem_graphic Funktion ein matplotlib.figure Objekt zurückgibt, so dass Sie die suptitle() Methode verwenden, sollten einen Titel hinzuzufügen.

try:

fig, b = stem_graphic(mileage['disp']) 
fig.suptitle("Vicky") 
0

Die stem_graphic Funktion aus dem stemgraphic Paket liefert eine Angabe und eine Achse; die docstring Staaten

:return: matplotlib figure and axes instance

Der Code sollte daher wie

aussehen
fig, ax =stem_graphic(mileage['disp']) 
ax.set_title("Vicky") 
Verwandte Themen