21
21
from . import (_api , _docstring , backend_tools , cbook , collections , colors ,
22
22
text as mtext , ticker , transforms )
23
23
from .lines import Line2D
24
- from .patches import Circle , Rectangle , Ellipse , Polygon
24
+ from .patches import Rectangle , Ellipse , Polygon
25
25
from .transforms import TransformedPatchPath , Affine2D
26
26
27
27
@@ -355,11 +355,10 @@ class Slider(SliderBase):
355
355
Slider value.
356
356
"""
357
357
358
- @_api .make_keyword_only ("3.7" , name = "valinit" )
359
- def __init__ (self , ax , label , valmin , valmax , valinit = 0.5 , valfmt = None ,
358
+ def __init__ (self , ax , label , valmin , valmax , * , valinit = 0.5 , valfmt = None ,
360
359
closedmin = True , closedmax = True , slidermin = None ,
361
360
slidermax = None , dragging = True , valstep = None ,
362
- orientation = 'horizontal' , * , initcolor = 'r' ,
361
+ orientation = 'horizontal' , initcolor = 'r' ,
363
362
track_color = 'lightgrey' , handle_style = None , ** kwargs ):
364
363
"""
365
364
Parameters
@@ -627,13 +626,13 @@ class RangeSlider(SliderBase):
627
626
Slider value.
628
627
"""
629
628
630
- @_api .make_keyword_only ("3.7" , name = "valinit" )
631
629
def __init__ (
632
630
self ,
633
631
ax ,
634
632
label ,
635
633
valmin ,
636
634
valmax ,
635
+ * ,
637
636
valinit = None ,
638
637
valfmt = None ,
639
638
closedmin = True ,
@@ -1283,60 +1282,6 @@ def disconnect(self, cid):
1283
1282
"""Remove the observer with connection id *cid*."""
1284
1283
self ._observers .disconnect (cid )
1285
1284
1286
- @_api .deprecated ("3.7" ,
1287
- addendum = "Any custom property styling may be lost." )
1288
- @property
1289
- def rectangles (self ):
1290
- if not hasattr (self , "_rectangles" ):
1291
- ys = np .linspace (1 , 0 , len (self .labels )+ 2 )[1 :- 1 ]
1292
- dy = 1. / (len (self .labels ) + 1 )
1293
- w , h = dy / 2 , dy / 2
1294
- rectangles = self ._rectangles = [
1295
- Rectangle (xy = (0.05 , ys [i ] - h / 2 ), width = w , height = h ,
1296
- edgecolor = "black" ,
1297
- facecolor = "none" ,
1298
- transform = self .ax .transAxes
1299
- )
1300
- for i , y in enumerate (ys )
1301
- ]
1302
- self ._frames .set_visible (False )
1303
- for rectangle in rectangles :
1304
- self .ax .add_patch (rectangle )
1305
- if not hasattr (self , "_lines" ):
1306
- with _api .suppress_matplotlib_deprecation_warning ():
1307
- _ = self .lines
1308
- return self ._rectangles
1309
-
1310
- @_api .deprecated ("3.7" ,
1311
- addendum = "Any custom property styling may be lost." )
1312
- @property
1313
- def lines (self ):
1314
- if not hasattr (self , "_lines" ):
1315
- ys = np .linspace (1 , 0 , len (self .labels )+ 2 )[1 :- 1 ]
1316
- self ._checks .set_visible (False )
1317
- dy = 1. / (len (self .labels ) + 1 )
1318
- w , h = dy / 2 , dy / 2
1319
- self ._lines = []
1320
- current_status = self .get_status ()
1321
- lineparams = {'color' : 'k' , 'linewidth' : 1.25 ,
1322
- 'transform' : self .ax .transAxes ,
1323
- 'solid_capstyle' : 'butt' ,
1324
- 'animated' : self ._useblit }
1325
- for i , y in enumerate (ys ):
1326
- x , y = 0.05 , y - h / 2
1327
- l1 = Line2D ([x , x + w ], [y + h , y ], ** lineparams )
1328
- l2 = Line2D ([x , x + w ], [y , y + h ], ** lineparams )
1329
-
1330
- l1 .set_visible (current_status [i ])
1331
- l2 .set_visible (current_status [i ])
1332
- self ._lines .append ((l1 , l2 ))
1333
- self .ax .add_line (l1 )
1334
- self .ax .add_line (l2 )
1335
- if not hasattr (self , "_rectangles" ):
1336
- with _api .suppress_matplotlib_deprecation_warning ():
1337
- _ = self .rectangles
1338
- return self ._lines
1339
-
1340
1285
1341
1286
class TextBox (AxesWidget ):
1342
1287
"""
@@ -1361,8 +1306,7 @@ class TextBox(AxesWidget):
1361
1306
The color of the text box when hovering.
1362
1307
"""
1363
1308
1364
- @_api .make_keyword_only ("3.7" , name = "color" )
1365
- def __init__ (self , ax , label , initial = '' ,
1309
+ def __init__ (self , ax , label , initial = '' , * ,
1366
1310
color = '.95' , hovercolor = '1' , label_pad = .01 ,
1367
1311
textalignment = "left" ):
1368
1312
"""
@@ -1513,8 +1457,7 @@ def set_val(self, val):
1513
1457
self ._observers .process ('change' , self .text )
1514
1458
self ._observers .process ('submit' , self .text )
1515
1459
1516
- @_api .delete_parameter ("3.7" , "x" )
1517
- def begin_typing (self , x = None ):
1460
+ def begin_typing (self ):
1518
1461
self .capturekeystrokes = True
1519
1462
# Disable keypress shortcuts, which may otherwise cause the figure to
1520
1463
# be saved, closed, etc., until the user stops typing. The way to
@@ -1856,23 +1799,6 @@ def disconnect(self, cid):
1856
1799
"""Remove the observer with connection id *cid*."""
1857
1800
self ._observers .disconnect (cid )
1858
1801
1859
- @_api .deprecated ("3.7" ,
1860
- addendum = "Any custom property styling may be lost." )
1861
- @property
1862
- def circles (self ):
1863
- if not hasattr (self , "_circles" ):
1864
- radius = min (.5 / (len (self .labels ) + 1 ) - .01 , .05 )
1865
- circles = self ._circles = [
1866
- Circle (xy = self ._buttons .get_offsets ()[i ], edgecolor = "black" ,
1867
- facecolor = self ._buttons .get_facecolor ()[i ],
1868
- radius = radius , transform = self .ax .transAxes ,
1869
- animated = self ._useblit )
1870
- for i in range (len (self .labels ))]
1871
- self ._buttons .set_visible (False )
1872
- for circle in circles :
1873
- self .ax .add_patch (circle )
1874
- return self ._circles
1875
-
1876
1802
1877
1803
class SubplotTool (Widget ):
1878
1804
"""
@@ -1974,8 +1900,7 @@ class Cursor(AxesWidget):
1974
1900
--------
1975
1901
See :doc:`/gallery/widgets/cursor`.
1976
1902
"""
1977
- @_api .make_keyword_only ("3.7" , "horizOn" )
1978
- def __init__ (self , ax , horizOn = True , vertOn = True , useblit = False ,
1903
+ def __init__ (self , ax , * , horizOn = True , vertOn = True , useblit = False ,
1979
1904
** lineprops ):
1980
1905
super ().__init__ (ax )
1981
1906
@@ -2109,8 +2034,6 @@ def __init__(self, canvas, axes, *, useblit=True, horizOn=False, vertOn=True,
2109
2034
2110
2035
self .connect ()
2111
2036
2112
- needclear = _api .deprecated ("3.7" )(lambda self : False )
2113
-
2114
2037
def connect (self ):
2115
2038
"""Connect events."""
2116
2039
for canvas , info in self ._canvas_infos .items ():
@@ -2613,8 +2536,7 @@ class SpanSelector(_SelectorWidget):
2613
2536
See also: :doc:`/gallery/widgets/span_selector`
2614
2537
"""
2615
2538
2616
- @_api .make_keyword_only ("3.7" , name = "minspan" )
2617
- def __init__ (self , ax , onselect , direction , minspan = 0 , useblit = False ,
2539
+ def __init__ (self , ax , onselect , direction , * , minspan = 0 , useblit = False ,
2618
2540
props = None , onmove_callback = None , interactive = False ,
2619
2541
button = None , handle_props = None , grab_range = 10 ,
2620
2542
state_modifier_keys = None , drag_from_anywhere = False ,
@@ -2957,8 +2879,7 @@ class ToolLineHandles:
2957
2879
for details.
2958
2880
"""
2959
2881
2960
- @_api .make_keyword_only ("3.7" , "line_props" )
2961
- def __init__ (self , ax , positions , direction , line_props = None ,
2882
+ def __init__ (self , ax , positions , direction , * , line_props = None ,
2962
2883
useblit = True ):
2963
2884
self .ax = ax
2964
2885
@@ -3068,8 +2989,7 @@ class ToolHandles:
3068
2989
for details.
3069
2990
"""
3070
2991
3071
- @_api .make_keyword_only ("3.7" , "marker" )
3072
- def __init__ (self , ax , x , y , marker = 'o' , marker_props = None , useblit = True ):
2992
+ def __init__ (self , ax , x , y , * , marker = 'o' , marker_props = None , useblit = True ):
3073
2993
self .ax = ax
3074
2994
props = {'marker' : marker , 'markersize' : 7 , 'markerfacecolor' : 'w' ,
3075
2995
'linestyle' : 'none' , 'alpha' : 0.5 , 'visible' : False ,
@@ -3771,8 +3691,7 @@ def onselect(verts):
3771
3691
which corresponds to all buttons.
3772
3692
"""
3773
3693
3774
- @_api .make_keyword_only ("3.7" , name = "useblit" )
3775
- def __init__ (self , ax , onselect , useblit = True , props = None , button = None ):
3694
+ def __init__ (self , ax , onselect , * , useblit = True , props = None , button = None ):
3776
3695
super ().__init__ (ax , onselect , useblit = useblit , button = button )
3777
3696
self .verts = None
3778
3697
props = {
@@ -3882,9 +3801,8 @@ class PolygonSelector(_SelectorWidget):
3882
3801
point.
3883
3802
"""
3884
3803
3885
- @_api .make_keyword_only ("3.7" , name = "useblit" )
3886
- def __init__ (self , ax , onselect , useblit = False ,
3887
- props = None , handle_props = None , grab_range = 10 , * ,
3804
+ def __init__ (self , ax , onselect , * , useblit = False ,
3805
+ props = None , handle_props = None , grab_range = 10 ,
3888
3806
draw_bounding_box = False , box_handle_props = None ,
3889
3807
box_props = None ):
3890
3808
# The state modifiers 'move', 'square', and 'center' are expected by
@@ -4199,8 +4117,7 @@ class Lasso(AxesWidget):
4199
4117
for details.
4200
4118
"""
4201
4119
4202
- @_api .make_keyword_only ("3.7" , name = "useblit" )
4203
- def __init__ (self , ax , xy , callback , useblit = True ):
4120
+ def __init__ (self , ax , xy , callback , * , useblit = True ):
4204
4121
super ().__init__ (ax )
4205
4122
4206
4123
self .useblit = useblit and self .canvas .supports_blit
0 commit comments