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

FIX: secondary_axis resize#13419

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

Conversation

jklymak
Copy link
Member

@jklymakjklymak commentedFeb 12, 2019
edited
Loading

PR Summary

As pointed out by@ImportanceOfBeingErnest the new secondary_axis (#11859) didn't survive a resize. This new version does.

Is there a good way to test resizing a canvas?

closes:#13417

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 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

@jklymakjklymak added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelFeb 12, 2019
@jklymakjklymak added this to thev3.1.0 milestoneFeb 12, 2019
def secondary_locator(ax, renderer):
bb = mtransforms.TransformedBbox(_rect, parent.transAxes)
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@anntzer Iknew there was a reason for this song and dance...

Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment mentioning this?

jklymak reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Good idea. Comment added.

@jklymakjklymakforce-pushed thefix-secondary-axis-resize branch from58b40fb to5cd9676CompareFebruary 12, 2019 03:26
@ImportanceOfBeingErnest
Copy link
Member

Concerning a test, the ugly result would be reproduced when callingfig.set_size_inches((7,4)) after creating the secondary axes and before drawing/saving it.

@jklymak
Copy link
MemberAuthor

Added test - fails on master, passes w/ this PR

@jklymakjklymakforce-pushed thefix-secondary-axis-resize branch from5114f7d tof96eba8CompareFebruary 12, 2019 06:11
@anntzer
Copy link
Contributor

anntzer commentedFeb 12, 2019
edited
Loading

Good catch.
I think the standard-ish way to avoid the fact that inverted() is "eager" would be

    bb = mtransforms.TransformedBbox(        mtransforms.Bbox.from_bounds(*rect),        mtransforms.BboxTransformFrom(parent.bbox)        + mtransforms.BboxTransformTo(parent.figure.bbox))    def secondary_locator(ax, renderer):        return bb    return secondary_locator

which also works, and avoids constructing new transform nodes at each call (#12031).
Or alternatively, use Transform.transform_bbox which constructs "dumb" bboxes that don't keep track of their transform stack.

@jklymak
Copy link
MemberAuthor

jklymak commentedFeb 12, 2019
edited
Loading

That makes there be no secondary axis rendered at all (or I guess its located off page?)

I'm pretty sure parent_bbox has to be the draw-time bbox, not the locator instantiation bbox.

@anntzer
Copy link
Contributor

Indeed, sorry.
I think such an approach could be made to work, but in the meantime this looks like a good fix.

@dstansbydstansby merged commitdaaf978 intomatplotlib:masterFeb 14, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@timhoffmtimhoffmtimhoffm approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v3.1.0
Development

Successfully merging this pull request may close these issues.

Secondary axis doesn't resize properly
6 participants
@jklymak@ImportanceOfBeingErnest@anntzer@QuLogic@timhoffm@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp