Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Code removal#3992

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
efiring merged 13 commits intomatplotlib:masterfromtacaswell:code_removal
Feb 6, 2015
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
48932c1
MNT : removed Axis.set_scale
tacaswellJan 10, 2015
48b8e6b
MNT : removed deprecated code in finance.py
tacaswellJan 10, 2015
310cab1
MNT : remove deprecated code from Annotation
tacaswellJan 10, 2015
843e16f
MNT : removed sphinxext/ipython_* files
tacaswellJan 10, 2015
d17863f
MNT : remove code to handle callable legend handlers
tacaswellJan 10, 2015
f431d48
MNT : remove LineCollection.color
tacaswellJan 10, 2015
a78746d
MNT : remove deprecated value of kwarg in tri.tripcolor
tacaswellJan 10, 2015
78aabc3
MNT : remove set_colorbar from ScalarMappable
tacaswellJan 10, 2015
f98c484
MNT : removed deprecated method/kwargs from patheffects
tacaswellJan 10, 2015
e0fd416
MNT : remove testing.image_util.py
tacaswellJan 10, 2015
2f30efc
MNT : remome mlab.FIFOBuffer
tacaswellJan 10, 2015
1f9023d
MNT : remove mlab.premca
tacaswellJan 10, 2015
056ba7a
MNT : Remove ``NavigationToolbar2QTAgg``
tacaswellJan 10, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
MNT : remove code to handle callable legend handlers
Deprecated in#2442 /9e0be95
  • Loading branch information
@tacaswell
tacaswell committedJan 22, 2015
commitd17863faa64e49caca1cf74288486112ab22f34c
8 changes: 7 additions & 1 deletiondoc/api/api_changes/code_removal.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,13 @@ Code Removal

Legend
------
Removed handling of `loc` as a positional argument to `Legend`
- Removed handling of `loc` as a positional argument to `Legend`


Legend handlers
~~~~~~~~~~~~~~~
Remove code to allow legend handlers to be callable. They must now
implement a method ``legend_artist``.


Axis
Expand Down
14 changes: 1 addition & 13 deletionslib/matplotlib/legend.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,8 +33,7 @@

from matplotlib import rcParams
from matplotlib.artist import Artist, allow_rasterization
from matplotlib.cbook import (is_string_like, iterable, silent_list, safezip,
warn_deprecated)
from matplotlib.cbook import (is_string_like, iterable, silent_list, safezip)
from matplotlib.font_manager import FontProperties
from matplotlib.lines import Line2D
from matplotlib.patches import Patch, Rectangle, Shadow, FancyBboxPatch
Expand DownExpand Up@@ -647,17 +646,6 @@ def _init_legend_box(self, handles, labels, markerfirst=True):
xdescent=0., ydescent=descent)
handleboxes.append(handlebox)

# Deprecate the old behaviour of accepting callable
# legend handlers in favour of the "legend_artist"
# interface.
if (not hasattr(handler, 'legend_artist') and
callable(handler)):
handler.legend_artist = handler.__call__
warn_deprecated('1.4',
('Legend handers must now implement a '
'"legend_artist" method rather than '
'being a callable.'))

# Create the artist for the legend which represents the
# original artist/handle.
handle_list.append(handler.legend_artist(self, orig_handle,
Expand Down
28 changes: 0 additions & 28 deletionslib/matplotlib/tests/test_legend.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,34 +170,6 @@ def test_legend_remove():

class TestLegendFunction(object):
# Tests the legend function on the Axes and pyplot.

@cleanup
def test_old_legend_handler_interface(self):
# Check the deprecated warning is created and that the appropriate
# call to the legend handler is made.
class AnyObject(object):
pass

class AnyObjectHandler(object):
def __call__(self, legend, orig_handle, fontsize, handlebox):
x0, y0 = handlebox.xdescent, handlebox.ydescent
width, height = handlebox.width, handlebox.height
patch = mpatches.Rectangle([x0, y0], width, height, facecolor='red',
edgecolor='black', hatch='xx', lw=3,
transform=handlebox.get_transform())
handlebox.add_artist(patch)
return patch

with mock.patch('warnings.warn') as warn:
plt.legend([None], ['My first handler'],
handler_map={None: AnyObjectHandler()})

warn.assert_called_with('Legend handers must now implement a '
'"legend_artist" method rather than '
'being a callable.',
MatplotlibDeprecationWarning,
stacklevel=1)

@cleanup
def test_legend_handle_label(self):
lines = plt.plot(range(10))
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp