Skip to content

Commit 3bbe997

Browse files
committed
Revert changes of other selectors and simplify parsing handle_props dictionary
1 parent f071815 commit 3bbe997

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

lib/matplotlib/widgets.py

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ class Cursor(AxesWidget):
15771577
15781578
Other Parameters
15791579
----------------
1580-
**props
1580+
**lineprops
15811581
`.Line2D` properties that control the appearance of the lines.
15821582
See also `~.Axes.axhline`.
15831583
@@ -1586,9 +1586,8 @@ class Cursor(AxesWidget):
15861586
See :doc:`/gallery/widgets/cursor`.
15871587
"""
15881588

1589-
@_api.rename_parameter("3.5", "lineprops", "props")
15901589
def __init__(self, ax, horizOn=True, vertOn=True, useblit=False,
1591-
**props):
1590+
**lineprops):
15921591
super().__init__(ax)
15931592

15941593
self.connect_event('motion_notify_event', self.onmove)
@@ -1600,9 +1599,9 @@ def __init__(self, ax, horizOn=True, vertOn=True, useblit=False,
16001599
self.useblit = useblit and self.canvas.supports_blit
16011600

16021601
if self.useblit:
1603-
props['animated'] = True
1604-
self.lineh = ax.axhline(ax.get_ybound()[0], visible=False, **props)
1605-
self.linev = ax.axvline(ax.get_xbound()[0], visible=False, **props)
1602+
lineprops['animated'] = True
1603+
self.lineh = ax.axhline(ax.get_ybound()[0], visible=False, **lineprops)
1604+
self.linev = ax.axvline(ax.get_xbound()[0], visible=False, **lineprops)
16061605

16071606
self.background = None
16081607
self.needclear = False
@@ -1676,9 +1675,8 @@ class MultiCursor(Widget):
16761675
plt.show()
16771676
16781677
"""
1679-
@_api.rename_parameter("3.5", "lineprops", "props")
16801678
def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
1681-
**props):
1679+
**lineprops):
16821680

16831681
self.canvas = canvas
16841682
self.axes = axes
@@ -1696,16 +1694,16 @@ def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
16961694
self.needclear = False
16971695

16981696
if self.useblit:
1699-
props['animated'] = True
1697+
lineprops['animated'] = True
17001698

17011699
if vertOn:
1702-
self.vlines = [ax.axvline(xmid, visible=False, **props)
1700+
self.vlines = [ax.axvline(xmid, visible=False, **lineprops)
17031701
for ax in axes]
17041702
else:
17051703
self.vlines = []
17061704

17071705
if horizOn:
1708-
self.hlines = [ax.axhline(ymid, visible=False, **props)
1706+
self.hlines = [ax.axhline(ymid, visible=False, **lineprops)
17091707
for ax in axes]
17101708
else:
17111709
self.hlines = []
@@ -2108,13 +2106,13 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
21082106
self.new_axes(ax)
21092107

21102108
# Setup handles
2111-
_handle_props = dict(color=props.get('facecolor', 'r'))
2112-
_handle_props.update(cbook.normalize_kwargs(handle_props,
2113-
Line2D._alias_map))
2109+
handle_props = {
2110+
'color': (props or{}).get('facecolor', 'r'),
2111+
**cbook.normalize_kwargs(handle_props, Line2D._alias_map)}
21142112

21152113
if self._interactive:
21162114
self._edge_order = ['min', 'max']
2117-
self._setup_edge_handle(_handle_props)
2115+
self._setup_edge_handle(handle_props)
21182116

21192117
self._active_handle = None
21202118

@@ -2676,29 +2674,25 @@ def __init__(self, ax, onselect, drawtype='box',
26762674

26772675
self.grab_range = grab_range
26782676

2679-
if props is None:
2680-
_handle_props = dict(markeredgecolor='black')
2681-
else:
2682-
_handle_props = dict(
2683-
markeredgecolor=props.get('edgecolor', 'black')
2684-
)
2685-
_handle_props.update(cbook.normalize_kwargs(handle_props,
2686-
Line2D._alias_map))
2677+
handle_props = {
2678+
'markeredgecolor': (props or {}).get('edgecolor', 'black'),
2679+
**cbook.normalize_kwargs(handle_props, Line2D._alias_map)}
2680+
26872681
self._corner_order = ['NW', 'NE', 'SE', 'SW']
26882682
xc, yc = self.corners
26892683
self._corner_handles = ToolHandles(self.ax, xc, yc,
2690-
marker_props=_handle_props,
2684+
marker_props=handle_props,
26912685
useblit=self.useblit)
26922686

26932687
self._edge_order = ['W', 'N', 'E', 'S']
26942688
xe, ye = self.edge_centers
26952689
self._edge_handles = ToolHandles(self.ax, xe, ye, marker='s',
2696-
marker_props=_handle_props,
2690+
marker_props=handle_props,
26972691
useblit=self.useblit)
26982692

26992693
xc, yc = self.center
27002694
self._center_handle = ToolHandles(self.ax, [xc], [yc], marker='s',
2701-
marker_props=_handle_props,
2695+
marker_props=handle_props,
27022696
useblit=self.useblit)
27032697

27042698
self._active_handle = None

0 commit comments

Comments
 (0)