The plt.subplots function in very practical for creating a large number of axes simultaneously, but (afaict) always puts them on a new figure, which is impractical e.g. when embedding matplotlib in a GUI, where a Figure object may be created early on and then populated with some axes later.
I would thus suggest providing the same functionality to already existing Figure objects, e.g. by moving the implementation of plt.subplots to a Figure.add_subplots (or Figure.set_subplots, as it may make sense to clear the figure before) method, and have the plt.subplots function be a thin wrapper that creates the Figure and then calls its add_subplots method.
The
plt.subplotsfunction in very practical for creating a large number of axes simultaneously, but (afaict) always puts them on a new figure, which is impractical e.g. when embedding matplotlib in a GUI, where a Figure object may be created early on and then populated with some axes later.I would thus suggest providing the same functionality to already existing Figure objects, e.g. by moving the implementation of
plt.subplotsto aFigure.add_subplots(orFigure.set_subplots, as it may make sense to clear the figure before) method, and have theplt.subplotsfunction be a thin wrapper that creates the Figure and then calls itsadd_subplotsmethod.