def createPlot():
fig = plt.figure(1, facecolor = 'white')
fig.clf()
createPlot.ax1 = plt.subplot(111, frameon = False)
plotNode('nonLeafNode', (0.2, 0.1), (0.4, 0.8), nonLeafNodes)
plotNode('LeafNode', (0.8, 0.1), (0.6, 0.8), leafNodes)
plt.show()
createPlot()
Was bedeutet createPlot.ax1
im Code? So einen Einsatz habe ich noch nie gesehen, deshalb bitte ich um Rat!
樓上說的沒問題,為什么沒有幫助呢?python中createPlot是函數(shù)同時(shí)也是一個(gè)對象,python中的對象實(shí)現(xiàn)類似字典類型,為對象動(dòng)態(tài)添加一個(gè)屬性是沒有問題的。