Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Don't draw axis (spines, ticks, labels) twice when using parasite axes.#11688

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 1 commit intomatplotlib:masterfromanntzer:axislines-draw-twice
Sep 23, 2018

Conversation

anntzer
Copy link
Contributor

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 thatonly involves deleting code :)

PR Summary

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

ImportanceOfBeingErnest reacted with hooray emoji
@ImportanceOfBeingErnest
Copy link
Member

👍 🎉

Before:

image

After:

image

@ImportanceOfBeingErnest
Copy link
Member

As this affectsevery 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
Copy link
ContributorAuthor

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 tothe superclass' get_children().Likewise, get_tightbbox() doesn't need to be overridden because thesuperclass' get_tightbbox by default usesget_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'tremove the labels anyways (and the tests are also about label placement).
@ImportanceOfBeingErnestImportanceOfBeingErnest added this to thev3.0.x milestoneSep 22, 2018
@tacaswelltacaswell merged commite771c1b intomatplotlib:masterSep 23, 2018
def new_floating_axis(self, nth_coord, value, axis_direction="bottom"):
gh = self.get_grid_helper()
axis = gh.new_floating_axis(nth_coord, value,
axis_direction=axis_direction,
axes=self)
return axis

def draw(self, renderer, inframe=False):
if not self._axisline_on:
Copy link
Member

Choose a reason for hiding this comment

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

This is correctly handled inget_children

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestSep 23, 2018
dstansby added a commit that referenced this pull requestSep 23, 2018
…688-on-v3.0.xBackport PR#11688 on branch v3.0.x (Don't draw axis (spines, ticks, labels) twice when using parasite axes.)
@anntzeranntzer deleted the axislines-draw-twice branchSeptember 23, 2018 09:54
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@ImportanceOfBeingErnestImportanceOfBeingErnestImportanceOfBeingErnest approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.0.1
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@ImportanceOfBeingErnest@tacaswell@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp