Anni_housie Anni_housie - 6 days ago 5
Python Question

python plot: object has no attribute 'set_xlable

import matplotlib.pyplot as plt

class Plot_it_for_me:

def flow_rate_graph(self, num, name):
figure, axes=plt.subplots()
title='Case ' + str(num) + ' ' + name
figure.canvas.set_window_title(title)
axes.set_title(title)
axes.set_xlable('units in milisecond')
axes.set_ylable(name +' in Hz')
plt.plot([1,2,3],[3,2,1])
#And do the plotting
plt.show()
axes.legend()


How come it shows give me error as:


AttributeError: 'AxesSubplot' object has no attribute 'set_xlable'


I am using python 2.7 with Annaconda btw.

Thanks

Answer

The method you're looking for is set_xlabel, not set_xlable (documentation link).

Comments