Description
This might not be a bug but I doubt that it is an intended behavior. figure.clf()
don't change the subplot parameters to any default values so it is not enough to do figure.clf()
when testing to plot with or without for example tight_layout
. This is easy to fix by adding for example:
keys = ('left', 'right', 'bottom','top','wspace','hspace')
subplots_default = {key : rcParams['figure.subplot.' + key] for key in keys}
self.subplotpars.update(**subplots_default)
to figure.clf()
When I looked into this I also found that the docstrings for subplots_adjust
and SubplotParams
are kind of confusing and not really correct. The default is, except in SuplotParams.__ini__
(that most people probably newer use directly), not the rc parameters that it seems but the actual attributes in the SuplotParams
object. So it is not trivial to start all over with the default rc variables after a change in the subplotparameters by for example tight_layout.
- Would it be good to add an option in subplot_adjust to adjust to the default parameters?
- Would it be good to add a get function for the subplotparameters?
The documentation should probably be changed anyway. Are there any method to avoid writing almost the same things several times? figure.subplots_adjust
and plt.subplots_adjust
should have more or less the exact same docstring and the SuplotParams
should also have a similar one.