jupyter/try-jupyter

Lorenz example: Matplotlib RuntimeWarning about many opened Figures

pierre-haessig opened this issue · 0 comments

Hi,
I just tested the new try-jupyterlab (https://jupyter.org/try-jupyter/lab/). Works great!

I noticed a minor issue with the Lorenz example notebook: when playing with the widget (w=interactive(solve_lorenz,sigma=(0.0,50.0),rho=(0.0,50.0)) cell) a few times, I get a RuntimeWarning from Matplotlib: too many opened Figures.

<ipython-input-2-1229d9258c9c>:7: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).
  fig = plt.figure()

Proposed fix: change the figure creation call withing def solve_lorenz(): from

fig = plt.figure()

to

fig = plt.figure(1)