Heim  >  Fragen und Antworten  >  Hauptteil

matplotlib – Problem mit der Python-Funktion

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!

習慣沉默習慣沉默2686 Tage vor680

Antworte allen(2)Ich werde antworten

  • phpcn_u1582

    phpcn_u15822017-06-12 09:26:15

    python中一切皆对象

    相当于给这个对象加了一个attr

    Antwort
    0
  • PHP中文网

    PHP中文网2017-06-12 09:26:15

    楼上说的没问题,为什么没有帮助呢?python中createPlot是函数同时也是一个对象,python中的对象实现类似字典类型,为对象动态添加一个属性是没有问题的。

    Antwort
    0
  • StornierenAntwort