How do I show the same matplotlib figure several times in a single IPython notebook?

后端 未结 1 1846
挽巷
挽巷 2020-12-10 04:46

I use IPython notebooks with matplotlib.pyplot and I often create a plot that requires a fairly large block of code to generate. I would then like to save the object and use

相关标签:
1条回答
  • 2020-12-10 05:01

    Just call myFigure in any cell after myFigure was assigned in cell before.

    For example in cell 1:

    In [1]:
    myFigure, myAx = plt.subplots()
    myAx.plot([1,2,3])
    

    In cell after that:

    In [2]:
    myFigure
    

    This will show myFigure

    0 讨论(0)
提交回复
热议问题