Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Figure object have no attribute set_title

I have used stem_graphic to plot a stem and leaf plot and saved it to pdf but when trying to enter title its giving error: Figure object have no attribute 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'
like image 726
Vicky Choudhary Avatar asked Jun 28 '17 19:06

Vicky Choudhary


1 Answers

It looks like your stem_graphic function returns a matplotlib.figure object, so you should use the suptitle() method to add a title.

try:

fig, b = stem_graphic(mileage['disp'])
fig.suptitle("Vicky")
like image 108
aorr Avatar answered Oct 23 '22 11:10

aorr