Skip to content

FIX: unit-convert pcolorargs before interpolating #18549

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

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Sep 23, 2020

PR Summary

Closes #18547

For pcolor(mesh) the new "nearest" interpolation was being done before unit conversion, so datetime (for instance) did not work. This moves unit conversion inside _pcolorargs.

from datetime import datetime

from matplotlib import pyplot as plt

x_coords = [datetime.fromtimestamp(x * 3600) for x in range(24)]
y_coords = [*range(0, 10)]
plt.pcolormesh(x_coords,
               y_coords, [[*range(24)] for _ in range(10)],
               shading="nearest")

plt.show()

failed before, and works now...

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • 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).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@jklymak jklymak force-pushed the fix-pcolorarg-convert-before-interp branch from d471a21 to 9a1af30 Compare September 23, 2020 13:57
@jklymak jklymak added this to the v3.3.3 milestone Sep 23, 2020
@jklymak jklymak force-pushed the fix-pcolorarg-convert-before-interp branch from 7c0711c to 9474ee6 Compare September 23, 2020 14:39
@jklymak jklymak force-pushed the fix-pcolorarg-convert-before-interp branch from 9474ee6 to 75097a2 Compare September 23, 2020 14:44
@jklymak jklymak marked this pull request as ready for review September 23, 2020 15:11
@tacaswell tacaswell merged commit a010c54 into matplotlib:master Sep 23, 2020
@lumberbot-app
Copy link

lumberbot-app bot commented Sep 23, 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.3.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 a010c54a5943bb5d7cd9f2dcae74217658025461
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #18549: FIX: unit-convert pcolorargs before interpolating'
  1. Push to a named branch :
git push YOURFORK v3.3.x:auto-backport-of-pr-18549-on-v3.3.x
  1. Create a PR against branch v3.3.x, I would have named this PR:

"Backport PR #18549 on branch v3.3.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 Author

jklymak commented Sep 23, 2020

I can do the back port. Its a bit of a PITA because we changed the unit handling for 3.4 but not 3.3.x....

@jklymak jklymak deleted the fix-pcolorarg-convert-before-interp branch September 23, 2020 18:19
jklymak pushed a commit to jklymak/matplotlib that referenced this pull request Sep 23, 2020
…t-before-interp

FIX: unit-convert pcolorargs before interpolating
@jklymak jklymak mentioned this pull request Sep 23, 2020
7 tasks
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.

pcolormesh x-axis with datetime broken for nearest shading
4 participants