2016-11-28 135 views
-3
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() 

爲什麼會出現以下錯誤?python劇情:對象沒有屬性'set_xlable'

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

我使用Python 2.7與Anaconda。

回答

2

您正在查找的方法是set_xlabel,而不是set_xlabledocumentation link)。

+0

什麼?所以這是拼寫錯誤? –

+1

是的。請參閱[鏈接](http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_xlabel)。 –

相關問題