def close_figure(as_subplot):
if not as_subplot:<EOL><INDENT>plt.close()<EOL><DEDENT>
After plotting and outputting a figure, close the matplotlib figure instance (omit if a subplot).

    Parameters
    -----------
    as_subplot : bool
        Whether the figure is part of subplot, in which case the figure is not closed so that the entire figure can \
        be closed later after output.