Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9869421

Browse files
authored
Merge pull request #20585 from ericpre/rename_parameter_selectors
Rename parameter selectors
2 parents 85be822 + 8682b5f commit 9869421

File tree

4 files changed

+276
-174
lines changed

4 files changed

+276
-174
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Unification of Selector API
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
The API for Selector widgets has been unified to use
4+
5+
- *props* for the properties of the Artist representing the selection.
6+
- *handle_props* for the Artists representing handles for modifying the selection.
7+
- *grab_range* for the maximal tolerance to grab a handle with the mouse.
8+
9+
This affects the following parameters and attributes:
10+
11+
12+
RectangleSelector and EllipseSelector
13+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
The *maxdist* argument is deprecated, use *grab_range* instead.
15+
The *rectprops* argument is deprecated, use *props* instead.
16+
The *marker_props* argument is deprecated, use *handle_props* instead.
17+
18+
PolygonSelector
19+
^^^^^^^^^^^^^^^
20+
The *vertex_select_radius* argument and attribute is deprecated, use *grab_range* instead.
21+
The *lineprops* argument is deprecated, use *props* instead.
22+
The *markerprops* argument is deprecated, use *handle_props* instead.
23+
The *maxdist* argument and attribute is deprecated, use *grab_range* instead.
24+
25+
SpanSelector
26+
^^^^^^^^^^^^
27+
The *rectprops* argument is deprecated, use *props* instead.
28+
The *maxdist* argument and attribute is deprecated, use *grab_range* instead.
29+
30+
LassoSelector
31+
^^^^^^^^^^^^^
32+
The *lineprops* argument is deprecated, use *props* instead.

examples/widgets/span_selector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def onselect(xmin, xmax):
5353
onselect,
5454
"horizontal",
5555
useblit=True,
56-
rectprops=dict(alpha=0.5, facecolor="tab:blue"),
56+
props=dict(alpha=0.5, facecolor="tab:blue"),
5757
interactive=True,
5858
drag_from_anywhere=True
5959
)

lib/matplotlib/tests/test_widgets.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_rectangle_selector():
5252
check_rectangle(drawtype='none', minspanx=10, minspany=10)
5353

5454
check_rectangle(minspanx=10, minspany=10, spancoords='pixels')
55-
check_rectangle(rectprops=dict(fill=True))
55+
check_rectangle(props=dict(fill=True))
5656

5757

5858
@pytest.mark.parametrize('drag_from_anywhere, new_center',
@@ -98,7 +98,7 @@ def onselect(epress, erelease):
9898
pass
9999

100100
tool = widgets.EllipseSelector(ax, onselect=onselect,
101-
maxdist=10, interactive=True)
101+
grab_range=10, interactive=True)
102102
tool.extents = (100, 150, 100, 150)
103103

104104
# drag the rectangle
@@ -152,8 +152,9 @@ def onselect(epress, erelease):
152152
pass
153153

154154
tool = widgets.RectangleSelector(ax, onselect=onselect,
155-
maxdist=10, interactive=True,
156-
marker_props={'markerfacecolor': 'r',
155+
grab_range=10,
156+
interactive=True,
157+
handle_props={'markerfacecolor': 'r',
157158
'markeredgecolor': 'b'})
158159
tool.extents = (100, 150, 100, 150)
159160

@@ -220,7 +221,7 @@ def onmove(vmin, vmax):
220221
def test_span_selector():
221222
check_span('horizontal', minspan=10, useblit=True)
222223
check_span('vertical', onmove_callback=True, button=1)
223-
check_span('horizontal', rectprops=dict(fill=True))
224+
check_span('horizontal', props=dict(fill=True))
224225

225226

226227
@pytest.mark.parametrize('drag_from_anywhere', [True, False])
@@ -319,7 +320,7 @@ def onselect(verts):
319320

320321
def test_lasso_selector():
321322
check_lasso_selector()
322-
check_lasso_selector(useblit=False, lineprops=dict(color='red'))
323+
check_lasso_selector(useblit=False, props=dict(color='red'))
323324
check_lasso_selector(useblit=True, button=1)
324325

325326

@@ -673,7 +674,7 @@ def onselect(verts):
673674
pass
674675

675676
tool = widgets.RectangleSelector(ax_test, onselect,
676-
rectprops={'visible': False})
677+
props={'visible': False})
677678
tool.extents = (0.2, 0.8, 0.3, 0.7)
678679

679680

0 commit comments

Comments
 (0)