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

inset locator fix with tests added#24783

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
dstansby merged 1 commit intomatplotlib:mainfrommatt256:PR_inset_locator
Jan 10, 2023

Conversation

matt256
Copy link
Contributor

PR Summary

Addresses the bug report#24589

From report:

When using inset_locator functions in subfigures, the plots are not placed correctly. Adapting this demo
https://matplotlib.org/stable/gallery/axes_grid1/demo_colorbar_of_inset_axes.html
to use subfigures shows incorrect plots.

Implemented the proposed resolution and wrote a unit test that validates the image referenced in the bug report is generated properly

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (andpytest passes)
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • [N/A] New plotting related features are documented with examples.

Release Notes

  • [N/A] New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • [N/A] API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • [N/A] Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

@@ -707,3 +707,36 @@ def test_removal():
fig.canvas.draw()
col.remove()
fig.canvas.draw()


@image_comparison(['anchored_locator_base_call.png'], style="mpl20")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@image_comparison(['anchored_locator_base_call.png'],style="mpl20")
@image_comparison(['anchored_locator_base_call.png'],style="mpl20",remove_text=True)

Or is the text a crucial part of the appearance?

(It is generally a good idea to remove the text if not needed, plus that it is cropped in this example.)

(A good approach to avoid conflicts is to insert the test at some random location in the file. This is as many insert it at the end and therefore it is more likely that there will be conflicts there. Hopefully this will be merged soon though.)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@oscargus. Thank you for the feedback. I agree with your comments but i had trouble generating a test image that would pass the image comparison test when remove_text is true. I do agree, however, that the test should be for just the image and not the text. I have resubmitted the test case where I didn't put the "remove_text" but did remove all the text in the test case and generate a test image without any text.

If this isn't quite acceptable, can you provide more details on your proposed approach? Thanks!

@matt256matt256force-pushed thePR_inset_locator branch 2 times, most recently from6ec5b75 to0e801e0CompareDecember 22, 2022 12:20
added remove_text to image comparison decoratorCo-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com>removed inaccurate commentsCo-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com>removed text from test image and testUpdate lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.pychanged subfigure generation to defaultCo-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>got rid of colorbarremoved colorbar and changed test image
@matt256
Copy link
ContributorAuthor

In the most recent commit, I removed the colorbar because it wasn't relevant to the test or the issue that this patch is meant to solve. Without the colorbar, the issue still presents itself before the fix and is resolved after it, regardless of the colorbar.

@matt256
Copy link
ContributorAuthor

@QuLogic ,@oscargus just wanted to follow up on this thread. Were there any other comments that still needed to be addressed?

@QuLogicQuLogic added this to thev3.6.3 milestoneJan 10, 2023
Copy link
Member

@dstansbydstansby left a comment

Choose a reason for hiding this comment

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

Looks good to me - thanks a lot, especially as this looks like your first PR to Matplotlib!

@lumberbot-app
Copy link

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.6.xgit pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 d3cf4291e4a23d7bde39fba96d82cc1416351836
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #24783: inset locator fix with tests added'
  1. Push to a named branch:
git push YOURFORK v3.6.x:auto-backport-of-pr-24783-on-v3.6.x
  1. Create a PR against branch v3.6.x, I would have named this PR:

"Backport PR#24783 on branch v3.6.x (inset locator fix with tests added)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove theStill Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free tosuggest an improvement.

dstansby added a commit to dstansby/matplotlib that referenced this pull requestJan 10, 2023
dstansby added a commit that referenced this pull requestJan 10, 2023
…783-on-v3.7.xBackport PR#24783 on branch v3.7.x (inset locator fix with tests added)
timhoffm added a commit that referenced this pull requestJan 10, 2023
…v3.6.x"Backport PR#24783 on branch v3.6.x (inset locator fix with tests added)"
@ksundenksunden mentioned this pull requestFeb 20, 2023
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@oscargusoscargusoscargus left review comments

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
None yet
Projects
Milestone
v3.6.3
Development

Successfully merging this pull request may close these issues.

[Bug]: inset_locator is broken when used with subfigures
4 participants
@matt256@QuLogic@dstansby@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp