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

Skip to content

Force origin='upper' in pyplot.specgram #17897

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 29 commits into from
Jul 15, 2020

Conversation

kate-perkins
Copy link
Contributor

@kate-perkins kate-perkins commented Jul 12, 2020

PR Summary

Fix #17878

In pyplot.specgram, the origin kwarg is popped. The origin is explicitly set to 'upper'
in the call to imshow inside pyplot.specgram. Test added to check that changing the
image.origin rcParam and the origin kwarg to 'lower' does not change the spectrogram.
Documentation updated with note that image.origin rcParam and origin kwarg are ignored.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/next_api_changes/* if API changed in a backward-incompatible way

dstansby and others added 8 commits July 12, 2020 12:13
Specify origin='upper' in call to imshow within specgram to override rcparams setting for origin without changing rcparams itself. Delete origin from kwargs so there are not two occurrences of the origin parameter in the call to imshow (this also means the origin kwarg cannot be changed by the caller).
@kate-perkins kate-perkins marked this pull request as draft July 12, 2020 17:26
@kate-perkins kate-perkins marked this pull request as ready for review July 12, 2020 17:54
@timhoffm
Copy link
Member

Please also update the API change note for not supporting 'origin' (instead of ignoring it).

@tacaswell tacaswell added this to the v3.4.0 milestone Jul 12, 2020
@kate-perkins kate-perkins marked this pull request as draft July 12, 2020 21:06
This ensures the origin kwarg is not silently ignored if passed to pyplot.specgram.
The function pyplot.specgram should raise a TypeError if origin is passed as a keyword argument.
kate-perkins and others added 2 commits July 13, 2020 17:40
This note referenced the call to imshow inside of specgram, which might confuse users who do not know the implementation of specgram.
@kate-perkins kate-perkins marked this pull request as ready for review July 14, 2020 01:45
Passing origin as a keyword argument should raise a type error, so test_specgram_origin_kwarg should raise an exception. Therefore, raises is a more precise check than xfail.
@jklymak jklymak requested a review from QuLogic July 14, 2020 14:35
@QuLogic
Copy link
Member

QuLogic commented Jul 14, 2020

The commit 77a2b67 shouldn't be here; I'm not sure how you got it. We can squash merge or you can rebase it out. Please ask in our gitter if you are having any trouble with this.

kate-perkins and others added 9 commits July 14, 2020 20:46
This note referenced the call to imshow inside of specgram, which might confuse users who do not know the implementation of specgram.
Passing origin as a keyword argument should raise a type error, so test_specgram_origin_kwarg should raise an exception. Therefore, raises is a more precise check than xfail.
@QuLogic
Copy link
Member

QuLogic commented Jul 15, 2020

Note, when you rebase, don't follow git's advice on push; that just creates duplicated commits, new from the rebase and old from the server. You do not want to pull the old commits that are already on GitHub, but throw them away. To do that, use git push --force-with-lease (or git push --force if you're confident) after rebasing.

@kate-perkins
Copy link
Contributor Author

I see. Is there a way I can fix that now, or should I leave the duplicate commits? Maybe it would be cleaner to squash merge after all. :)

@QuLogic
Copy link
Member

QuLogic commented Jul 15, 2020

Yes, that could be done (git rebase -i again, drop the old commits and git push --force-with-lease), but a squash merge might be easiest, and skip an extra CI run.

@QuLogic QuLogic merged commit 7a4df1a into matplotlib:master Jul 15, 2020
@QuLogic
Copy link
Member

QuLogic commented Jul 15, 2020

Thanks @kate-perkins and @thedorathanasiadis!

@kate-perkins
Copy link
Contributor Author

Thank you to everybody who reviewed this PR!

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.

flipping of imshow in specgram
7 participants