ENH: Allow to register standalone figures with pyplot · matplotlib/matplotlib@56f4ee1 · GitHub
Skip to content

Commit 56f4ee1

Browse files
committed
ENH: Allow to register standalone figures with pyplot
It may be fundamentally nice not to have to create the figure though pyplot to be able to use it in pyplot afterwards. You can now do ``` from matplotlib.figure import Figure import matplotlib.pyplot as plt fig = Figure() fig.subplots().plot([1, 3, 2]) plt.figure(fig) # fig is now tracked in pyplot plt.show() ``` This also opens up the possibility to more dynamically track and untrack figures in pyplot, which opens up the road to optimized figure tracking in pyplot (#29849)
1 parent 77993d5 commit 56f4ee1

2 files changed

Lines changed: 43 additions & 4 deletions

File tree

lib/matplotlib/pyplot.py

Lines changed: 19 additions & 4 deletions

lib/matplotlib/tests/test_pyplot.py

Lines changed: 24 additions & 0 deletions

0 commit comments

Comments
 (0)