Repository navigation
Don't draw axis (spines, ticks, labels) twice when using parasite axes. - #11688
Merged
Merged
Conversation
Member
Member
|
As this affects every axes drawn with the toolkits, I would think this is significant enough to get a what's new entry (there are no bug-fixed entries, right?) to tell people that those axes now look as great as the usual matplotlib axes and are hence even usable for publication quality figures. Is it too late to get this into 3.0? |
anntzer
force-pushed
the
axislines-draw-twice
branch
from
July 18, 2018 12:18
b0ced54 to
8e88094
Compare
Contributor
Author
|
Added a whatsnew. I don't particularly care re: 3.0 or not. |
We can just defer to the superclass' draw (axes._base.Axes.draw) which will correctly draw everything in get_children(); axislines.Axes.get_children already adds the axislines and gridlines to the superclass' get_children(). Likewise, get_tightbbox() doesn't need to be overridden because the superclass' get_tightbbox by default uses get_default_bbox_extra_artists, which fetches all visible children. (This point is not needed for the bugfix, but we may as well...) Don't bother using remove_text in the new figures, because that doesn't remove the labels anyways (and the tests are also about label placement).
anntzer
force-pushed
the
axislines-draw-twice
branch
from
July 18, 2018 12:45
8e88094 to
929bffb
Compare
ImportanceOfBeingErnest
approved these changes
Sep 22, 2018
tacaswell
reviewed
Sep 23, 2018
| return axis | ||
|
|
||
| def draw(self, renderer, inframe=False): | ||
| if not self._axisline_on: |
Member
There was a problem hiding this comment.
This is correctly handled in get_children
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Sep 23, 2018
… twice when using parasite axes.
dstansby
added a commit
that referenced
this pull request
Sep 23, 2018
…688-on-v3.0.x Backport PR #11688 on branch v3.0.x (Don't draw axis (spines, ticks, labels) twice when using parasite axes.)
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.


We can just defer to the superclass' draw (axes._base.Axes.draw)
which will correctly draw everything in get_children();
axislines.Axes.get_children already adds the axislines and gridlines to
the superclass' get_children().
Likewise, get_tightbbox() doesn't need to be overridden because the
superclass' get_tightbbox by default uses
get_default_bbox_extra_artists, which fetches all visible children.
(This point is not needed for the bugfix, but we may as well...)
Don't bother using remove_text in the new figures, because that doesn't
remove the labels anyways (and the tests are also about label placement).
Issue pointed out by @tacaswell in #11602 (comment) and @ImportanceOfBeingErnest in #11602 (comment).
I feel like I should charge a quarter for every bugfix that only involves deleting code :)
PR Summary
PR Checklist