Remove deprecations that expire in 3.3#17239
Merged
Merged
Conversation
3fb898a to
36d5d78
Compare
Member
Author
|
There's still a few left:
|
These were documented as being removed in 3.1, though should have been at least 3.2, but 3.3 works.
36d5d78 to
a30e8e7
Compare
Member
|
I will take care of #12430 in a separate PR. |
timhoffm
approved these changes
Apr 25, 2020
| @@ -444,28 +444,15 @@ def __init__(self, parent, handles, labels, | |||
| loc = 'upper right' | |||
| if isinstance(loc, str): | |||
| if loc not in self.codes: | |||
Member
There was a problem hiding this comment.
Would this now better be a try except KeyError: raise ValueError?
Member
Author
There was a problem hiding this comment.
I think that just clutters the traceback:
In [2]: plt.figure().legend(loc='ca')with the try, adds one more traceback frame, which is not really any clearer to anyone:
KeyError Traceback (most recent call last)
~/code/matplotlib/lib/matplotlib/legend.py in __init__(self, parent, handles, labels, loc, numpoints, markerscale, markerfirst, scatterpoints, scatteryoffsets, prop, fontsize, borderpad, labelspacing, handlelength, handleheight, handletextpad, borderaxespad, columnspacing, ncol, mode, fancybox, shadow, title, title_fontsize, framealpha, edgecolor, facecolor, bbox_to_anchor, bbox_transform, frameon, handler_map)
446 try:
--> 447 loc = self.codes[loc]
448 except KeyError:
KeyError: 'ca'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-2-c48871c74701> in <module>()
----> 1 plt.figure().legend(loc='ca')
~/code/matplotlib/lib/matplotlib/figure.py in legend(self, *args, **kwargs)
1827 # extra_args = extra_args[1:]
1828 pass
-> 1829 l = mlegend.Legend(self, handles, labels, *extra_args, **kwargs)
1830 self.legends.append(l)
1831 l._remove_method = self.legends.remove
~/code/matplotlib/lib/matplotlib/legend.py in __init__(self, parent, handles, labels, loc, numpoints, markerscale, markerfirst, scatterpoints, scatteryoffsets, prop, fontsize, borderpad, labelspacing, handlelength, handleheight, handletextpad, borderaxespad, columnspacing, ncol, mode, fancybox, shadow, title, title_fontsize, framealpha, edgecolor, facecolor, bbox_to_anchor, bbox_transform, frameon, handler_map)
449 raise ValueError(
450 "Unrecognized location {!r}. Valid locations are\n\t{}\n"
--> 451 .format(loc, '\n\t'.join(self.codes)))
452 if not self.isaxes and loc == 0:
453 raise ValueError(
ValueError: Unrecognized location 'ca'. Valid locations are
best
upper right
upper left
lower left
lower right
right
center left
center right
lower center
upper center
center
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
See title. There are still a few left, but they need different changes.
Also, sort the removal list (this looks a little bigger than it really is.)
PR Checklist