Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Warn on non-increasing/decreasing pcolor coords #18398

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

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

greglucas
Copy link
Contributor

PR Summary

pcolor* will now automatically calculate bin edges for users if shading is 'auto' or 'nearest'. This can lead to surprising resulting edge calculations if the coordinate arrays are not sorted prior to calling the function.

Addresses part of #18317. This would be good to get into v3.3.2 for at least warning users about this use case and then leave the other potential screen-space interpolations for v3.4.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [N/A] New features are documented, with examples if plot related.
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and pydocstyle<4 and run flake8 --docstring-convention=all).

pcolor* will now automatically calculate bin edges for users
if shading is 'auto' or 'nearest'. This can lead to surprising
resulting edge calculations if the coordinate arrays are not
sorted prior to calling the function.
if not (np.all(dX >= 0) or np.all(dX <= 0)):
cbook._warn_external(
f"The input coordinates to {funcname} are "
"not all either increasing or decreasing, "
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After writing the PR. Maybe "sorted" is a better word to use here? I'm open to suggestions about the text.

@jklymak
Copy link
Member

jklymak commented Sep 2, 2020

I'm not sure if putting a warning in, when we are planning to remove it, is necessarily a good idea?

@greglucas
Copy link
Contributor Author

Good question I'm not sure either. Are you also certain you'll change the behavior for 3.4?

This would have made the issue in #18317 much more obvious where things were going wrong right from the beginning, so it is just a nice to have, not critical at all.

@greglucas
Copy link
Contributor Author

I'm going to close this for now and assume something will supersede it in the 3.4 release.

@greglucas greglucas closed this Sep 14, 2020
@greglucas greglucas deleted the warn_pcolorargs branch September 14, 2020 00:54
@jklymak
Copy link
Member

jklymak commented Sep 14, 2020

Can we reopen it just so we can know we need to fix this? If something supersedes it we can just close this then? Thanks!

@greglucas greglucas restored the warn_pcolorargs branch September 14, 2020 00:59
@greglucas greglucas reopened this Sep 14, 2020
@dopplershift dopplershift added this to the v3.3.2 milestone Sep 14, 2020
@tacaswell tacaswell modified the milestones: v3.3.2, v3.2.3 Sep 14, 2020
@dopplershift dopplershift merged commit 80550e1 into matplotlib:master Sep 14, 2020
@dopplershift
Copy link
Contributor

Was this intentionally milestoned to 3.2.3?

@lumberbot-app
Copy link

lumberbot-app bot commented Sep 14, 2020

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.2.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 80550e132779c2e461e5a765e1bed578ae5c34fb
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #18398: Warn on non-increasing/decreasing pcolor coords'
  1. Push to a named branch :
git push YOURFORK v3.2.x:auto-backport-of-pr-18398-on-v3.2.x
  1. Create a PR against branch v3.2.x, I would have named this PR:

"Backport PR #18398 on branch v3.2.x"

And apply the correct labels and milestones.

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

If these instruction are inaccurate, feel free to suggest an improvement.

@jklymak
Copy link
Member

jklymak commented Sep 14, 2020

Nope, should have been 3.3.2

@jklymak
Copy link
Member

jklymak commented Sep 14, 2020

@meeseeksdev backport v3.3.2

@QuLogic
Copy link
Member

QuLogic commented Sep 14, 2020

The existing backport PR is good.

@jklymak
Copy link
Member

jklymak commented Sep 14, 2020

Hmmm, actually, based on the call, I'd have rephrased this a bit....

@jklymak
Copy link
Member

jklymak commented Sep 14, 2020

See #18483

dopplershift added a commit that referenced this pull request Sep 15, 2020
…398-on-v3.3.x

Backport PR #18398 on branch v3.3.x (Warn on non-increasing/decreasing pcolor coords)
@greglucas greglucas deleted the warn_pcolorargs branch October 28, 2020 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants