Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

figure.clf() and subplots_adjust #11059

Copy link
Copy link
Closed
@fredrik-1

Description

@fredrik-1
Issue body actions

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.

rudrathegreat

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.