matplotlib: can I create AxesSubplot objects, then add them to a Figure instance?

后端 未结 3 996
一整个雨季
一整个雨季 2020-11-22 12:08

Looking at the matplotlib documentation, it seems the standard way to add an AxesSubplot to a Figure is to use Figure.add_subplo

3条回答
  •  清酒与你
    2020-11-22 12:57

    For line plots, you can deal with the Line2D objects themselves:

    fig1 = pylab.figure()
    ax1 = fig1.add_subplot(111)
    lines = ax1.plot(scipy.randn(10))
    
    fig2 = pylab.figure()
    ax2 = fig2.add_subplot(111)
    ax2.add_line(lines[0])
    

提交回复
热议问题