'Closes figure by cleaning up data and layout dictionaries.
The PlotlyRenderer\'s job is to create an appropriate set of data and
layout dictionaries. When the figure is closed, some cleanup and
repair is necessary. This method removes inappropriate dictionary
entries, freeing up Plotly to use defaults and best judgements to
complete the entries. This method is called by an Exporter object.
Positional arguments:
fig -- a matplotlib.figure.Figure object.'

def close_figure(self, fig):

    self.plotly_fig.force_clean()
    self.plotly_fig['layout']['showlegend'] = False
    self.msg += 'Closing    figure\n'
