使用matplotlib的plot_directive显示每一步的更新情节

ast*_*rog 5 python plot matplotlib python-sphinx

我正在使用Matplotlib的plot_directive Sphinx扩展,并且有类似的东西:

.. plot::
   :context:
   :include-source:

    import matplotlib.pyplot as plt
    fig = plt.figure()
    ax = fig.add_subplot(1,1,1)
    [stuff here]

Text here

.. plot::
   :context:
   :include-source:

    ax.set_xlim(0., 100.)
    ax.set_ylim(0., 100.)
Run Code Online (Sandbox Code Playgroud)

问题是该情节第二次没有出现.我可以获得另一个绘图的唯一方法是实例化一个新的plt.figure().有没有办法强制输出图出现在上例中的第二个..plot指令之后,而无需从头开始重新创建新图?