Skip to content

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

Merged
merged 10 commits into from
Apr 27, 2020

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Apr 24, 2020

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

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • [N/A] New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • [N/A] 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

@QuLogic QuLogic added this to the v3.3.0 milestone Apr 24, 2020
@QuLogic QuLogic force-pushed the remove-deprecations branch from 3fb898a to 36d5d78 Compare April 25, 2020 04:02
@QuLogic
Copy link
Member Author

QuLogic commented Apr 25, 2020

There's still a few left:

@QuLogic QuLogic force-pushed the remove-deprecations branch from 36d5d78 to a30e8e7 Compare April 25, 2020 05:30
@timhoffm
Copy link
Member

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:
Copy link
Member

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?

Copy link
Member Author

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

@tacaswell tacaswell merged commit 002b27e into matplotlib:master Apr 27, 2020
@QuLogic QuLogic deleted the remove-deprecations branch April 27, 2020 22:44
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