代碼有一類matplotlib.axes.AxesSubplot,但模塊matplotlib.axes有沒有屬性AxesSubplot
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
print type(ax)
給出輸出
<class 'matplotlib.axes.AxesSubplot'>
然後代碼
import matplotlib.axes
matplotlib.axes.AxesSubplot
引發異常
AttributeError: 'module' object has no attribute 'AxesSubplot'
總之,有一個類matplotlib.axes.AxesSubplot
,但模塊matplotlib.axes
沒有屬性AxesSubplot
。究竟是怎麼回事?
我正在使用Matplotlib 1.1.0和Python 2.7.3。
有沒有你想用此方法解決一個實際問題,或者這個問題只是好奇心? – Julian 2012-07-27 15:17:57
@Julian:這只是「好奇心」。我相信好奇心讓你成爲更好的開發者。 – user763305 2012-07-27 15:21:16