'return a dictionary of subplot layout parameters. The default
parameters are from rcParams unless a figure attribute is set.'

def get_subplot_params(self, fig=None):

    from matplotlib.figure import SubplotParams
    import copy
    if (fig is None):
        kw = {k: rcParams[(u'figure.subplot.' + k)] for k in self._AllowedKeys}
        subplotpars = SubplotParams(**kw)
    else:
        subplotpars = copy.copy(fig.subplotpars)
    update_kw = {k: getattr(self, k) for k in self._AllowedKeys}
    subplotpars.update(**update_kw)
    return subplotpars
