-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
func
argument in legend_elements
with non-monotonically increasing functions
#17546
Conversation
func
argument in legend_elements
with non-monotonically increasing functions
It's not clear to me why we bother going through this interpolation. After all, immediately above we assume that |
I suppose because the label values are the "starting point" to ideally get somewhat even/round numbers to display. The inverse of |
I'm pretty sure I just forgot that |
The test failures are unrelated. However, please add a test for this new case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modulo adding a test.
Added a test. I'm fairly new to this, so I'm not sure if the test is causing some of these failures. However, there were a lot of failures initially with this PR, though I don't know how they were resolved before these recent changes. |
If you rebase this, it should fix the CI failures. |
Account for inverse (or other) relationships where `np.interp` will not work correctly.
Thanks @rlung! |
Account for inverse (or other) relationships where
np.interp
will not work correctly.PR Summary
legend_elements
does not account for inverse or non-monotonically increasing functions. See this post for an example. The problem is in usingnp.interp
, which requires a monotonically increasing inputxp
. This PR sortsxp
first before callingnp.interp
.PR Checklist