Skip to content

Commit f49a08f

Browse files
committed
Revert changes of other selectors and simplify parsing handle_props dictionary
1 parent a22f8cb commit f49a08f

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
@@ -1449,7 +1449,7 @@ class Cursor(AxesWidget):
14491449
14501450
Other Parameters
14511451
----------------
1452-
**props
1452+
**lineprops
14531453
`.Line2D` properties that control the appearance of the lines.
14541454
See also `~.Axes.axhline`.
14551455
@@ -1458,9 +1458,8 @@ class Cursor(AxesWidget):
14581458
See :doc:`/gallery/widgets/cursor`.
14591459
"""
14601460

1461-
@_api.rename_parameter("3.5", "lineprops", "props")
14621461
def __init__(self, ax, horizOn=True, vertOn=True, useblit=False,
1463-
**props):
1462+
**lineprops):
14641463
super().__init__(ax)
14651464

14661465
self.connect_event('motion_notify_event', self.onmove)
@@ -1472,9 +1471,9 @@ def __init__(self, ax, horizOn=True, vertOn=True, useblit=False,
14721471
self.useblit = useblit and self.canvas.supports_blit
14731472

14741473
if self.useblit:
1475-
props['animated'] = True
1476-
self.lineh = ax.axhline(ax.get_ybound()[0], visible=False, **props)
1477-
self.linev = ax.axvline(ax.get_xbound()[0], visible=False, **props)
1474+
lineprops['animated'] = True
1475+
self.lineh = ax.axhline(ax.get_ybound()[0], visible=False, **lineprops)
1476+
self.linev = ax.axvline(ax.get_xbound()[0], visible=False, **lineprops)
14781477

14791478
self.background = None
14801479
self.needclear = False
@@ -1548,9 +1547,8 @@ class MultiCursor(Widget):
15481547
plt.show()
15491548
15501549
"""
1551-
@_api.rename_parameter("3.5", "lineprops", "props")
15521550
def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
1553-
**props):
1551+
**lineprops):
15541552

15551553
self.canvas = canvas
15561554
self.axes = axes
@@ -1568,16 +1566,16 @@ def __init__(self, canvas, axes, useblit=True, horizOn=False, vertOn=True,
15681566
self.needclear = False
15691567

15701568
if self.useblit:
1571-
props['animated'] = True
1569+
lineprops['animated'] = True
15721570

15731571
if vertOn:
1574-
self.vlines = [ax.axvline(xmid, visible=False, **props)
1572+
self.vlines = [ax.axvline(xmid, visible=False, **lineprops)
15751573
for ax in axes]
15761574
else:
15771575
self.vlines = []
15781576

15791577
if horizOn:
1580-
self.hlines = [ax.axhline(ymid, visible=False, **props)
1578+
self.hlines = [ax.axhline(ymid, visible=False, **lineprops)
15811579
for ax in axes]
15821580
else:
15831581
self.hlines = []
@@ -1976,13 +1974,13 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
19761974
self.new_axes(ax)
19771975

19781976
# Setup handles
1979-
_handle_props = dict(color=props.get('facecolor', 'r'))
1980-
_handle_props.update(cbook.normalize_kwargs(handle_props,
1981-
Line2D._alias_map))
1977+
handle_props = {
1978+
'color': (props or{}).get('facecolor', 'r'),
1979+
**cbook.normalize_kwargs(handle_props, Line2D._alias_map)}
19821980

19831981
if self._interactive:
19841982
self._edge_order = ['min', 'max']
1985-
self._setup_edge_handle(_handle_props)
1983+
self._setup_edge_handle(handle_props)
19861984

19871985
self._active_handle = None
19881986

@@ -2544,29 +2542,25 @@ def __init__(self, ax, onselect, drawtype='box',
25442542

25452543
self.grab_range = grab_range
25462544

2547-
if props is None:
2548-
_handle_props = dict(markeredgecolor='black')
2549-
else:
2550-
_handle_props = dict(
2551-
markeredgecolor=props.get('edgecolor', 'black')
2552-
)
2553-
_handle_props.update(cbook.normalize_kwargs(handle_props,
2554-
Line2D._alias_map))
2545+
handle_props = {
2546+
'markeredgecolor': (props or {}).get('edgecolor', 'black'),
2547+
**cbook.normalize_kwargs(handle_props, Line2D._alias_map)}
2548+
25552549
self._corner_order = ['NW', 'NE', 'SE', 'SW']
25562550
xc, yc = self.corners
25572551
self._corner_handles = ToolHandles(self.ax, xc, yc,
2558-
marker_props=_handle_props,
2552+
marker_props=handle_props,
25592553
useblit=self.useblit)
25602554

25612555
self._edge_order = ['W', 'N', 'E', 'S']
25622556
xe, ye = self.edge_centers
25632557
self._edge_handles = ToolHandles(self.ax, xe, ye, marker='s',
2564-
marker_props=_handle_props,
2558+
marker_props=handle_props,
25652559
useblit=self.useblit)
25662560

25672561
xc, yc = self.center
25682562
self._center_handle = ToolHandles(self.ax, [xc], [yc], marker='s',
2569-
marker_props=_handle_props,
2563+
marker_props=handle_props,
25702564
useblit=self.useblit)
25712565

25722566
self._active_handle = None

0 commit comments

Comments
 (0)