-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove deprecations that expire in 3.3 #17239
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
3fb898a
to
36d5d78
Compare
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
I will take care of #12430 in a separate PR. |
@@ -444,28 +444,15 @@ def __init__(self, parent, handles, labels, | |||
loc = 'upper right' | |||
if isinstance(loc, str): | |||
if loc not in self.codes: |
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.
Would this now better be a try except KeyError: raise ValueError
?
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 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
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