@@ -2268,94 +2268,19 @@ class BoxStyle(_Style):
2268
2268
2269
2269
%(AvailableBoxstyles)s
2270
2270
2271
- An instance of any boxstyle class is an callable object,
2272
- whose call signature is::
2271
+ An instance of any boxstyle class is an callable object, whose call
2272
+ signature is::
2273
2273
2274
- __call__(self, x0, y0, width, height, mutation_size)
2274
+ __call__(self, x0, y0, width, height, mutation_size) -> Path
2275
2275
2276
- and returns a `.Path` instance. *x0*, *y0*, *width* and
2277
- *height* specify the location and size of the box to be
2278
- drawn. *mutation_scale* determines the overall size of the
2279
- mutation (by which I mean the transformation of the rectangle to
2280
- the fancy box).
2276
+ *x0*, *y0*, *width* and *height* specify the location and size of the box
2277
+ to be drawn; *mutation_size* scales the outline properties such as padding.
2281
2278
"""
2282
2279
2283
2280
_style_list = {}
2284
2281
2285
- @_api .deprecated ("3.4" )
2286
- class _Base :
2287
- """
2288
- Abstract base class for styling of `.FancyBboxPatch`.
2289
-
2290
- This class is not an artist itself. The `__call__` method returns the
2291
- `~matplotlib.path.Path` for outlining the fancy box. The actual drawing
2292
- is handled in `.FancyBboxPatch`.
2293
-
2294
- Subclasses may only use parameters with default values in their
2295
- ``__init__`` method because they must be able to be initialized
2296
- without arguments.
2297
-
2298
- Subclasses must implement the `__call__` method. It receives the
2299
- enclosing rectangle *x0, y0, width, height* as well as the
2300
- *mutation_size*, which scales the outline properties such as padding.
2301
- It returns the outline of the fancy box as `.path.Path`.
2302
- """
2303
-
2304
- @_api .deprecated ("3.4" )
2305
- def transmute (self , x0 , y0 , width , height , mutation_size ):
2306
- """Return the `~.path.Path` outlining the given rectangle."""
2307
- return self (self , x0 , y0 , width , height , mutation_size , 1 )
2308
-
2309
- # This can go away once the deprecation period elapses, leaving _Base
2310
- # as a fully abstract base class just providing docstrings, no logic.
2311
- def __init_subclass__ (cls ):
2312
- transmute = _api .deprecate_method_override (
2313
- __class__ .transmute , cls , since = "3.4" )
2314
- if transmute :
2315
- cls .__call__ = transmute
2316
- return
2317
-
2318
- __call__ = cls .__call__
2319
-
2320
- @_api .delete_parameter ("3.4" , "mutation_aspect" )
2321
- def call_wrapper (
2322
- self , x0 , y0 , width , height , mutation_size ,
2323
- mutation_aspect = _api .deprecation ._deprecated_parameter ):
2324
- if mutation_aspect is _api .deprecation ._deprecated_parameter :
2325
- # Don't trigger deprecation warning internally.
2326
- return __call__ (self , x0 , y0 , width , height , mutation_size )
2327
- else :
2328
- # Squeeze the given height by the aspect_ratio.
2329
- y0 , height = y0 / mutation_aspect , height / mutation_aspect
2330
- path = self (x0 , y0 , width , height , mutation_size ,
2331
- mutation_aspect )
2332
- vertices , codes = path .vertices , path .codes
2333
- # Restore the height.
2334
- vertices [:, 1 ] = vertices [:, 1 ] * mutation_aspect
2335
- return Path (vertices , codes )
2336
-
2337
- cls .__call__ = call_wrapper
2338
-
2339
- def __call__ (self , x0 , y0 , width , height , mutation_size ):
2340
- """
2341
- Given the location and size of the box, return the path of
2342
- the box around it.
2343
-
2344
- Parameters
2345
- ----------
2346
- x0, y0, width, height : float
2347
- Location and size of the box.
2348
- mutation_size : float
2349
- A reference scale for the mutation.
2350
-
2351
- Returns
2352
- -------
2353
- `~matplotlib.path.Path`
2354
- """
2355
- raise NotImplementedError ('Derived must override' )
2356
-
2357
2282
@_register_style (_style_list )
2358
- class Square ( _Base ) :
2283
+ class Square :
2359
2284
"""A square box."""
2360
2285
2361
2286
def __init__ (self , pad = 0.3 ):
@@ -2378,7 +2303,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2378
2303
closed = True )
2379
2304
2380
2305
@_register_style (_style_list )
2381
- class Circle ( _Base ) :
2306
+ class Circle :
2382
2307
"""A circular box."""
2383
2308
2384
2309
def __init__ (self , pad = 0.3 ):
@@ -2399,7 +2324,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2399
2324
max (width , height ) / 2 )
2400
2325
2401
2326
@_register_style (_style_list )
2402
- class LArrow ( _Base ) :
2327
+ class LArrow :
2403
2328
"""A box in the shape of a left-pointing arrow."""
2404
2329
2405
2330
def __init__ (self , pad = 0.3 ):
@@ -2441,7 +2366,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2441
2366
return p
2442
2367
2443
2368
@_register_style (_style_list )
2444
- class DArrow ( _Base ) :
2369
+ class DArrow :
2445
2370
"""A box in the shape of a two-way arrow."""
2446
2371
# Modified from LArrow to add a right arrow to the bbox.
2447
2372
@@ -2478,7 +2403,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2478
2403
closed = True )
2479
2404
2480
2405
@_register_style (_style_list )
2481
- class Round ( _Base ) :
2406
+ class Round :
2482
2407
"""A box with round corners."""
2483
2408
2484
2409
def __init__ (self , pad = 0.3 , rounding_size = None ):
@@ -2538,7 +2463,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2538
2463
return path
2539
2464
2540
2465
@_register_style (_style_list )
2541
- class Round4 ( _Base ) :
2466
+ class Round4 :
2542
2467
"""A box with rounded edges."""
2543
2468
2544
2469
def __init__ (self , pad = 0.3 , rounding_size = None ):
@@ -2589,7 +2514,7 @@ def __call__(self, x0, y0, width, height, mutation_size):
2589
2514
return path
2590
2515
2591
2516
@_register_style (_style_list )
2592
- class Sawtooth ( _Base ) :
2517
+ class Sawtooth :
2593
2518
"""A box with a sawtooth outline."""
2594
2519
2595
2520
def __init__ (self , pad = 0.3 , tooth_size = None ):
@@ -4025,11 +3950,9 @@ def set_boxstyle(self, boxstyle=None, **kwargs):
4025
3950
"""
4026
3951
if boxstyle is None :
4027
3952
return BoxStyle .pprint_styles ()
4028
-
4029
- if isinstance (boxstyle , BoxStyle ._Base ) or callable (boxstyle ):
4030
- self ._bbox_transmuter = boxstyle
4031
- else :
4032
- self ._bbox_transmuter = BoxStyle (boxstyle , ** kwargs )
3953
+ self ._bbox_transmuter = (
3954
+ BoxStyle (boxstyle , ** kwargs ) if isinstance (boxstyle , str )
3955
+ else boxstyle )
4033
3956
self .stale = True
4034
3957
4035
3958
def set_mutation_scale (self , scale ):
0 commit comments