8000 deprecate Legend.draggable in favor of Legend.set_draggable · matplotlib/matplotlib@4d3f7eb · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d3f7eb

Browse files
committed
deprecate Legend.draggable in favor of Legend.set_draggable
1 parent d443579 commit 4d3f7eb

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

doc/api/api_changes/2017-12-20-TH.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations
2+
````````````
3+
4+
`.Legend.draggable()` is drepecated in favor of `.Legend.set_draggable()`.
5+
``Legend.draggable`` may be reintroduced as a property in future releases.

lib/matplotlib/backends/qt_editor/figureoptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def apply_callback(data):
242242
ncol = old_legend._ncol
243243
new_legend = axes.legend(ncol=ncol)
244244
if new_legend:
245-
new_legend.draggable(draggable)
245+
new_legend.set_draggable(draggable)
246246

247247
# Redraw
248248
figure = axes.get_figure()

lib/matplotlib/legend.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from matplotlib import rcParams
3232
from matplotlib import docstring
3333
from matplotlib.artist import Artist, allow_rasterization
34-
from matplotlib.cbook import silent_list, is_hashable
34+
from matplotlib.cbook import silent_list, is_hashable, warn_deprecated
3535
import matplotlib.colors as colors
3636
from matplotlib.font_manager import FontProperties
3737
from matplotlib.lines import Line2D
@@ -1155,6 +1155,12 @@ def draggable(self, state=None, use_blit=False, update="loc"):
11551155
when dragged. If update is "loc", the *loc* parameter of the legend
11561156
is changed. If "bbox", the *bbox_to_anchor* parameter is changed.
11571157
"""
1158+
warn_deprecated("2.2",
1159+
message="Legend.draggable() is drepecated in "
1160+
"favor of Legend.set_draggable(). "
1161+
"Legend.draggable may be reintroduced as a "
1162+
"property in future releases.")
1163+
11581164
if state is None:
11591165
state = not self.get_draggable() # toggle state
11601166

0 commit comments

Comments
 (0)
0