Repository navigation
Rework a bit axes addition. - #13269
Merged
Merged
Conversation
tacaswell
approved these changes
Jan 27, 2019
timhoffm
reviewed
Jan 28, 2019
| sentinel = object() | ||
| real_label = kwargs.pop("label", sentinel) | ||
| twin = self.figure.add_subplot( | ||
| self.get_subplotspec(), *args, label=sentinel, **kwargs) |
Member
There was a problem hiding this comment.
Is it safe to set label to an object instance? According to the docstring it must be a str. Even if it works now, it might cause problems with future changes. Maybe use something like str(uuid.uuid4()) instead?
- Let _make_twin_axes rely on Axes.add_axes, rather than replicating its logic with process_projection_requirements. This needs a little dance to force add_axes to always create a new axes instead of returning a previously existing one though. - Then process_projection_requirements becomes only used by Figure.add_axes and Figure.add_subplot, so make it a private Figure method. - Cut-and-paste Figure._make_key to move it next to Figure._process_projection_requirements, which is itself next to add_axes and add_subplot. - Factor out some more common code between add_axes and add_subplot.
timhoffm
approved these changes
Jan 28, 2019
timhoffm
left a comment
Member
There was a problem hiding this comment.
Anybody can merge after CI pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
its logic with process_projection_requirements. This needs a little
dance to force add_axes to always create a new axes instead of
returning a previously existing one though.
Figure.add_axes and Figure.add_subplot, so make it a private Figure
method.
Figure._process_projection_requirements, which is itself next to
add_axes and add_subplot. (Note that github shows this as add_artist
moving above _make_key, rather than the other way round...)
Preliminary work towards fixing #12513 (the end goal being to move the reactivation logic into pyplot).
PR Summary
PR Checklist