Skip to content

fetch rcParams for Figures in fig.clf(), issue #7434 #9622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from

Conversation

NNiehof
Copy link

@NNiehof NNiehof commented Oct 29, 2017

PR Summary

Optionally consult rcParams again in clf, issue #7434
The parameters that Figure gets from rcParams on creation are optionally fetched again in clf if reset_rcparams is set to True. By default, this is set to False and thus disabled.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Optionally fetch rcParams again in clf, issue matplotlib#7434
@tacaswell tacaswell added this to the v2.2 milestone Oct 29, 2017
self._suptitle = None
self.stale = True

def clear(self, keep_observers=False):
def clear(self, keep_observers=False, disable_rc_fetch=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to also pass the kwarg to clf

@@ -1226,12 +1230,14 @@ def _break_share_link(ax, grouper):
if last_ax is not None:
_reset_loc_form(last_ax.xaxis)

def clf(self, keep_observers=False):
def clf(self, keep_observers=False, disable_rc_fetch=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite my comments in #7434 , I think a non-inverted kwarg (ex reset_rcparams=False) would be easier to understand.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I'll change it.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

In addition to the two comments, this will need a test (so we don't break it in the future) and an entry in whats_new (so people know it exists so they can use it).

@tacaswell
Copy link
Member

If you are feeling ambitious can you also convert the docsctrings to numpydoc (https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt) format?

@@ -336,6 +336,7 @@ def __init__(self,
raise ValueError('figure size must be finite not '
'{}'.format(figsize))
self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)
self.figsize = figsize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need these lines? How did these used to be handled?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because these parameters have to be accessed by clf, outside the scope of init. Before, they were only used within that scope.

fixed error: accidentally overwrote fig.tight_layout
@QuLogic
Copy link
Member

QuLogic commented Nov 13, 2017

I suggest that all these new attributes should be private (prefix with _).

new figure properties set to private, and set the properties to their
new values
@NNiehof
Copy link
Author

NNiehof commented Nov 20, 2017

I've made changes to make sure that the figure properties are actually changed to the fetched rcparams in clf, and the new attributes that were made to do this are now marked as private.

@NNiehof
Copy link
Author

NNiehof commented Dec 10, 2017

The unit test, what's new entry, docstring et cetera are in there.

@jklymak jklymak marked this pull request as draft September 12, 2020 20:40
@jklymak jklymak requested review from tacaswell and removed request for tacaswell September 12, 2020 20:40
@tacaswell
Copy link
Member

I took a look at rebasing this and there have been enough changes to the figure.py that it is probably easier to re-implement this than to actually do the rebase.

@NNiehof I'm loath to close PRs, however I think given how far out of sync with the main branch this has gotten I am going to close it 😞 . I apologize that this get lost in review (which is on me), I hope we will hear from you again in the future.

@tacaswell tacaswell closed this Dec 4, 2022
@NNiehof
Copy link
Author

NNiehof commented Dec 4, 2022

I guess we can say this has lost its relevance at this point 😄

@tacaswell tacaswell removed this from the future releases milestone Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants