-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Changed return type of get_{x,y}ticklabels to plain list #17028
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
Changed return type of get_{x,y}ticklabels to plain list #17028
Conversation
@anntzer @timhoffm another way will be to change matplotlib/lib/matplotlib/axis.py Line 1176 in da8789b
matplotlib/lib/matplotlib/axis.py Line 1169 in da8789b
matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py Line 845 in da8789b
So, I think we have only one option to typecast it. Any suggestions? |
Thanks for working on this! In addition to the actually changes this will also need a note in https://github.com/matplotlib/matplotlib/blob/master/doc/api/next_api_changes/behaviour.rst |
I see the case for changing this is either Axes or Axis. If we are going to do it to x and y, the same should be done for z (inconsistency is one of the most frustrating things for users and one of our biggest problems). Doing it in On balance, given that this api change is primarily on the repr not the coding side (it still has the chance to break people if they are relying on doing anything but looking with their eyes at stdout) I think the "make things as consistent as possible" wins over "make the smallest change you can" so please make the change in Axis. |
I will be happy to make there changes once #17021 is merged. Otherwise it will result in conflicts. So, waiting for it to be merged. |
Dealing with merge conflicts / rebases is (for better or worse) a normal part of the workflow on Matplotlib :/ . It is also possible that, so long as there are no over lapping changes to the contents, git will handle the rename smoothly. |
Ok. Let me do it now then. |
|
||
`get_xticklabels` and `get_yticklabels` now returns plain list | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Previously, get_xticklabels and get_yticklabels returns silent_list. |
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.
Can enumerate all of the methods that will be changed? The audience for this will not have the context you current have. What are the consequences of this change? Who is likely to be affected? What can they do to get the old behavior back?
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.
I have two questions in my mind. 1st next_api_changes are the changes in the upcoming release which has not been shipped to market yet. Please correct me if I am wrong.
2nd: behaviour.rst is meant for knowing the changes across releases. Correct me if I am wrong.
thanks
I am :+1 in principle, but I think the API change notes needs a bit more context. |
Per #16903 (review) the change should be made on the Axis method, not the Axes wrappers. |
…o change_return_type_to_normal_list
44 tests are failing due to indirectly/directly using |
You need to change the constructor call (the list constructor doesn't take a name, unlike the silent_list one). |
Done! Kindly review. Thanks |
lib/matplotlib/axis.py
Outdated
@@ -1171,14 +1171,14 @@ def get_majorticklabels(self): | |||
ticks = self.get_major_ticks() | |||
labels1 = [tick.label1 for tick in ticks if tick.label1.get_visible()] | |||
labels2 = [tick.label2 for tick in ticks if tick.label2.get_visible()] | |||
return cbook.silent_list('Text major ticklabel', labels1 + labels2) | |||
return list(labels1 + labels2) |
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.
you don't even need the list
call here; labels1 + labels2
is already a list.
same below.
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.
yeah, my mistake. corrected!
…o change_return_type_to_normal_list
b9e9b41
to
352f688
Compare
Rebased |
14ca83b
to
352f688
Compare
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.
You're finding out the nitpicky nature of reStructuredText 😄. I've provided some hints how to placate Sphinx.
Co-Authored-By: Tim Hoffmann <[email protected]>
Co-Authored-By: Tim Hoffmann <[email protected]>
Co-Authored-By: Tim Hoffmann <[email protected]>
Yeah, sphinx is easy to understand. Varied syntaxes and an uncountable number of new things I am learning here :-) |
So, Circle CI is for Sphinx? |
That's great! Thanks |
I think |
Thanks @SidharthBansal! I‘ve squashed the commits before merging. We try to keep the commits reasonably focused to keep our history clean. Since you plan to contribute more, I encouraged you to organize your PRs directly into one or a few semantically separated commits. It‘s ok and common practice to force-push to your feature branch for the fixes and incremental updates. |
I will abide by the advice. Thanks! |
PR Summary
Changed return type of get_{x,y}ticklabels to plain list
Fixes #16885
PR Checklist