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

Add Axes.fill_disjoint to make invert fill_between easier#24742

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

Draft
antarapal235 wants to merge9 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromKevin1212918:fill-disjoint

Conversation

antarapal235
Copy link

@antarapal235antarapal235 commentedDec 15, 2022
edited
Loading

PR Summary

This PRfixes#23768, which asks for an easy solution to invert the fill between 2 lines. In this PR, we wrote a new patch called Lines which bounds the y axis and fixes the unbounded limits problem discussed in the issue. We also wrote the function fill_disjoint which fills in the area excluding the region in between the lines bounded by (x, y1) and (x, y2), which are inputted into the function. Thus, these changes allow users to invert fill of simple shapes composed of straight lines.

PR Checklist

Documentation and Tests

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

Release Notes

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

Copy link

@github-actionsgithub-actionsbot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping@matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join uson gitter for real-time discussion.

For details on testing, writing docs, and our review process, please seethe developer guide

We strive to be a welcoming and open project. Please follow ourCode of Conduct.

Copy link
Member

@oscargusoscargus left a comment

Choose a reason for hiding this comment

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

Thank you for this! I just left some minor comments for now.

The imagetest.png should be removed as it is not used(?).

This is a good start (and the code quality is high, with good documentation!), but expect that there are things to be discussed.

For your info: we are in the final stages of feature freezing 3.7, so it may take a while before you get proper feedback (or it may not).

This could also do with a release note. Although in some sense it is OK to wait with that until the reviews start to converge, it can also be a good option to highlight the feature. For example, showing off different options and capabilities. See, e.g.,https://github.com/matplotlib/matplotlib/blob/main/doc/users/next_whats_new/ellipse_annotation.rst what it may look like. (In your case I would go with a subplot with few different plots.)

@@ -1066,6 +1066,123 @@ def set_data(self, values=None, edges=None, baseline=None):
self.stale = True


class Lines(Patch):
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs a better name.BoundedSemiplane?

"""
*xy* is a numpy array with shape Nx2.

If *direction* is *True*, the patch is lower bounded by the polyline.
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if there is a better name fordirection?lowerbounded?lower?lower_bounded?

@@ -45,6 +45,30 @@
# different baseline images to prevent race conditions when pytest runs
# the tests with multiple threads.

@image_comparison(['fill_disjoint'], remove_text=False)
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(['fill_disjoint'],remove_text=False)
@image_comparison(['fill_disjoint.png'],remove_text=False,style='mpl20')

fig, ax = plt.subplots()
plt.plot(xRng, [f1(x) for x in xRng], 'b-')
plt.plot(xRng, [f2(x) for x in xRng], 'r-')
# Uncomment below line to test other configs
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be removed. Or simply just add another test.

@antarapal235
Copy link
Author

Thank you so much@oscargus for these helpful suggestions. We just included them in our most recent commit.

antarapal235and others added7 commitsDecember 15, 2022 18:32
Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com>
Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com>
Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com>
@jklymak
Copy link
Member

This is failing all the tests. Can you include a description in the PR of what this does with code? Maybe also argue for the need for the extra complexity - it's not clear to me we should add all this. Finally, the new tests probably don't need to be in all the different file types?

@jklymakjklymak added status: needs clarificationIssues that need more information to resolve. status: needs revision labelsFeb 2, 2023
@jklymakjklymak marked this pull request as draftFebruary 9, 2023 19:50
@jklymak
Copy link
Member

I'll move to draft, but feel free to move back when ready to move forward (if desired). Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@oscargusoscargusoscargus left review comments

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
Status: Waiting for author
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[ENH]: fill_between invert?
5 participants
@antarapal235@jklymak@oscargus@story645@jasonper0042

[8]ページ先頭

©2009-2025 Movatter.jp