Skip to content

RuntimeWarning in reportGen: "More than 20 figures have been opened."

When running glance reportgen on files that have a "large" number of variables that cannot be scatter plotted, you'll get this warning:

/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py:516: 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`).

The problem is that create_complex_scatter_plot in /pyglance/glance/figures.py around line 277 has a failure path that doesn't plt.close the created but unused figure.

22-too-many-figures has a one-line patch to solve this; it calls plt.close(figure).

Edited by Alan De Smet