Title: figure.clf() and subplots_adjust · Issue #11059 · matplotlib/matplotlib · GitHub
Open Graph Title: figure.clf() and subplots_adjust · Issue #11059 · matplotlib/matplotlib
X Title: figure.clf() and subplots_adjust · Issue #11059 · matplotlib/matplotlib
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_lay...
Open Graph 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 pl...
X 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 t...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/11059
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"figure.clf() and subplots_adjust","articleBody":"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:\r\n```\r\nkeys = ('left', 'right', 'bottom','top','wspace','hspace')\r\nsubplots_default = {key : rcParams['figure.subplot.' + key] for key in keys}\r\nself.subplotpars.update(**subplots_default)\r\n```\r\nto figure.clf()\r\n\r\nWhen 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. \r\n\r\n- Would it be good to add an option in subplot_adjust to adjust to the default parameters? \r\n- Would it be good to add a get function for the subplotparameters? \r\n\r\nThe 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.\r\n","author":{"url":"https://github.com/fredrik-1","@type":"Person","name":"fredrik-1"},"datePublished":"2018-04-16T16:15:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/11059/matplotlib/issues/11059"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:95c590a9-2d24-25d8-f7f5-bb5c80b00ae5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 910C:2B4DBA:677FCA:899F0B:6A52FE6B |
| html-safe-nonce | 23f298a871ac9e836489ce00c674690595e8fbeecbbd4c9f1af1f0b9d38666ad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MTBDOjJCNERCQTo2NzdGQ0E6ODk5RjBCOjZBNTJGRTZCIiwidmlzaXRvcl9pZCI6IjI1NTg5MzQ2ODc3NDI2MjMzMzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | cc216fc49e5cd944e0228fa4d13e4dd99a048f207d19e6c34661a31449ed2c39 |
| hovercard-subject-tag | issue:314724769 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/11059/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5aaf8ebda31f98211c963f23bc0f8c6e11c4e8b4b751ac436b02381b40c5b35a/matplotlib/matplotlib/issues/11059 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5aaf8ebda31f98211c963f23bc0f8c6e11c4e8b4b751ac436b02381b40c5b35a/matplotlib/matplotlib/issues/11059 |
| og:image:alt | 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 pl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fredrik-1 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width