Skip to content

Trying to set the labels without setting ticks through pyplot now raises TypeError* #15927

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

Conversation

rscmendes
Copy link

PR Summary

This PR was suggested in issue #15005 as to fix the error that is returned when xticks() or yticks() is called with only the labels as parameters. It is also a follow up from PR #15788.

Previously, passing labels without passing the ticks to either pyplot.xticks() and pyplot.yticks() would result in TypeError: object of type 'NoneType' has no len(). With this PR it now returns:
AttributeError: Labels can't be set without setting ticks.

PS: apologies for the delay.

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/api_changes.rst if API changed in a backward-incompatible way

@rscmendes rscmendes force-pushed the throw-error-on-empty-ticks-for-issue-15005 branch from d963707 to 274fbdc Compare December 14, 2019 00:36
@rscmendes rscmendes changed the title Trying to set the labels without setting ticks through pyplot now raises AttributeError Trying to set the labels without setting ticks through pyplot now raises TypeError* Dec 14, 2019
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Commits should be squashed.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

This should get an entry in doc/api/next_api_changes/behavior.rst.

@rscmendes rscmendes force-pushed the throw-error-on-empty-ticks-for-issue-15005 branch from 274fbdc to a9ebd40 Compare December 15, 2019 14:31
@rscmendes
Copy link
Author

Sorry for the flask8 compliance issue, thought it was OK with 80 but should've tested -- still have a lot to learn. Should be good now.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Thanks! From my side, this is good to go. Waiting for a second positive review.

Commits should still be squashed. Can be done by the author locally + force-push; or if you're not that familiar with git, we'll squash through the github interface when merging.

@rscmendes rscmendes force-pushed the throw-error-on-empty-ticks-for-issue-15005 branch from a9ebd40 to 86dd139 Compare December 16, 2019 00:23
@anntzer
Copy link
Contributor

anntzer commented Dec 16, 2019

Thanks for the PR, hoping to see you around again :)

@anntzer anntzer merged commit 03b255d into matplotlib:master Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants