2017-06-28 2 views
0

私はstem_graphicを使って茎と葉のプロットをプロットし、pdfに保存しましたが、タイトルを入力しようとするとエラー:Figure object have no attribute set_titleになりました。図オブジェクトには属性がありません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' 

答えて

0

あなたstem_graphic機能がmatplotlib.figureオブジェクトを返すので、あなたがタイトルを追加するsuptitle()メソッドを使用する必要があるように見えます。

試し:stemgraphicパッケージから

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

stem_graphic機能は、FigureとAxesを返します。 docstring状態

:return: matplotlib figure and axes instance

は、コードがゆえ

fig, ax =stem_graphic(mileage['disp']) 
ax.set_title("Vicky") 
のようになります。
関連する問題