@@ -1909,26 +1909,24 @@ class BoxStyle(_Style):
1909
1909
1910
1910
class _Base :
1911
1911
"""
1912
- :class:`BBoxTransmuterBase` and its derivatives are used to make a
1913
- fancy box around a given rectangle. The :meth:`__call__` method
1914
- returns the :class:`~matplotlib.path.Path` of the fancy box. This
1915
- class is not an artist and actual drawing of the fancy box is done
1916
- by the :class:`FancyBboxPatch` class.
1917
- """
1912
+ Abstract base class for styling of `.FancyBboxPatch`.
1918
1913
1919
- # The derived classes are required to be able to be initialized
1920
- # w/o arguments, i.e., all its argument (except self) must have
1921
- # the default values.
1914
+ This class is not an artist itself. The `__call__` method returns the
1915
+ `~matplotlib.path.Path` for outlining the fancy box. The actual drawing
1916
+ is handled in `.FancyBboxPatch`.
1917
+
1918
+ Subclasses may only use parameters with default values in their
1919
+ ``__init__`` method because they must be able to be initialized
1920
+ without arguments.
1921
+
1922
+ Subclasses must implement the `transmute` method. It receives the
1923
+ enclosing rectangle *x0, y0, width, height* as well as the
1924
+ *mutation_size*, which scales the outline properties such as padding.
1925
+ It returns the outline of the fancy box as `.path.Path`.
1926
+ """
1922
1927
1923
1928
def transmute (self , x0 , y0 , width , height , mutation_size ):
1924
- """
1925
- The transmute method is a very core of the
1926
- :class:`BboxTransmuter` class and must be overridden in the
1927
- subclasses. It receives the location and size of the
1928
- rectangle, and the mutation_size, with which the amount of
1929
- padding and etc. will be scaled. It returns a
1930
- :class:`~matplotlib.path.Path` instance.
1931
- """
1929
+ """Return the `~.path.Path` outlining the given rectangle."""
1932
1930
raise NotImplementedError ('Derived must override' )
1933
1931
1934
1932
def __call__ (self , x0 , y0 , width , height , mutation_size ,
@@ -1937,9 +1935,18 @@ def __call__(self, x0, y0, width, height, mutation_size,
1937
1935
Given the location and size of the box, return the path of
1938
1936
the box around it.
1939
1937
1940
- - *x0*, *y0*, *width*, *height* : location and size of the box
1941
- - *mutation_size* : a reference scale for the mutation.
1942
- - *aspect_ratio* : aspect-ration for the mutation.
1938
+ Parameters
1939
+ ----------
1940
+ x0, y0, width, height : float
1941
+ Location and size of the box.
1942
+ mutation_size : float
1943
+ A reference scale for the mutation.
1944
+ aspect_ratio : float, default: 1
1945
+ Aspect-ratio for the mutation.
1946
+
1947
+ Returns
1948
+ -------
1949
+ path : `~matplotlib.path.Path`
1943
1950
"""
1944
1951
# The __call__ method is a thin wrapper around the transmute method
1945
1952
# and takes care of the aspect.
@@ -1959,15 +1966,14 @@ def __call__(self, x0, y0, width, height, mutation_size,
1959
1966
@_register_style (_style_list )
1960
1967
class Square (_Base ):
1961
1968
"""
1962
- A simple square box.
1963
- """
1969
+ A square box.
1964
1970
1971
+ Parameters
1972
+ ----------
1973
+ pad : float, default: 0.3
1974
+ The amount of padding around the original box.
1975
+ """
1965
1976
def __init__ (self , pad = 0.3 ):
1966
- """
1967
- Parameters
1968
- ----------
1969
- pad : float
1970
- """
1971
1977
self .pad = pad
1972
1978
super ().__init__ ()
1973
1979
@@ -1987,14 +1993,15 @@ def transmute(self, x0, y0, width, height, mutation_size):
1987
1993
1988
1994
@_register_style (_style_list )
1989
1995
class Circle (_Base ):
1990
- """A simple circle box."""
1996
+ """
1997
+ A circular box.
1998
+
1999
+ Parameters
2000
+ ----------
2001
+ pad : float, default: 0.3
2002
+ The amount of padding around the original box.
2003
+ """
1991
2004
def __init__ (self , pad = 0.3 ):
1992
- """
1993
- Parameters
1994
- ----------
1995
- pad : float
1996
- The amount of padding around the original box.
1997
- """
1998
2005
self .pad = pad
1999
2006
super ().__init__ ()
2000
2007
@@ -2010,7 +2017,12 @@ def transmute(self, x0, y0, width, height, mutation_size):
2010
2017
@_register_style (_style_list )
2011
2018
class LArrow (_Base ):
2012
2019
"""
2013
- (left) Arrow Box
2020
+ A box in the shape of a left-pointing arrow.
2021
+
2022
+ Parameters
2023
+ ----------
2024
+ pad : float, default: 0.3
2025
+ The amount of padding around the original box.
2014
2026
"""
2015
2027
def __init__ (self , pad = 0.3 ):
2016
2028
self .pad = pad
@@ -2048,9 +2060,13 @@ def transmute(self, x0, y0, width, height, mutation_size):
2048
2060
@_register_style (_style_list )
2049
2061
class RArrow (LArrow ):
2050
2062
"""
2051
- (right) Arrow Box
2052
- """
2063
+ A box in the shape of a right-pointing arrow.
2053
2064
2065
+ Parameters
2066
+ ----------
2067
+ pad : float, default: 0.3
2068
+ The amount of padding around the original box.
2069
+ """
2054
2070
def __init__ (self , pad = 0.3 ):
2055
2071
super ().__init__ (pad )
2056
2072
@@ -2063,7 +2079,12 @@ def transmute(self, x0, y0, width, height, mutation_size):
2063
2079
@_register_style (_style_list )
2064
2080
class DArrow (_Base ):
2065
2081
"""
2066
- (Double) Arrow Box
2082
+ A box in the shape of a two-way arrow.
2083
+
2084
+ Parameters
2085
+ ----------
2086
+ pad : float, default: 0.3
2087
+ The amount of padding around the original box.
2067
2088
"""
2068
2089
# This source is copied from LArrow,
2069
2090
# modified to add a right arrow to the bbox.
@@ -2114,16 +2135,15 @@ def transmute(self, x0, y0, width, height, mutation_size):
2114
2135
class Round (_Base ):
2115
2136
"""
2116
2137
A box with round corners.
2117
- """
2118
2138
2139
+ Parameters
2140
+ ----------
2141
+ pad : float, default: 0.3
2142
+ The amount of padding around the original box.
2143
+ rounding_size : float, default: *pad*
2144
+ Radius of the corners.
2145
+ """
2119
2146
def __init__ (self , pad = 0.3 , rounding_size = None ):
2120
- """
2121
- *pad*
2122
- amount of padding
2123
-
2124
- *rounding_size*
2125
- rounding radius of corners. *pad* if None
2126
- """
2127
2147
self .pad = pad
2128
2148
self .rounding_size = rounding_size
2129
2149
super ().__init__ ()
@@ -2175,17 +2195,16 @@ def transmute(self, x0, y0, width, height, mutation_size):
2175
2195
@_register_style (_style_list )
2176
2196
class Round4 (_Base ):
2177
2197
"""
2178
- Another box with round edges.
2179
- """
2198
+ A box with rounded edges.
2180
2199
2200
+ Parameters
2201
+ ----------
2202
+ pad : float, default: 0.3
2203
+ The amount of padding around the original box.
2204
+ rounding_size : float, default: *pad*/2
2205
+ Rounding of edges.
2206
+ """
2181
2207
def __init__ (self , pad = 0.3 , rounding_size = None ):
2182
- """
2183
- *pad*
2184
- amount of padding
2185
-
2186
- *rounding_size*
2187
- rounding size of edges. *pad* if None
2188
- """
2189
2208
self .pad = pad
2190
2209
self .rounding_size = rounding_size
2191
2210
super ().__init__ ()
@@ -2228,17 +2247,16 @@ def transmute(self, x0, y0, width, height, mutation_size):
2228
2247
@_register_style (_style_list )
2229
2248
class Sawtooth (_Base ):
2230
2249
"""
2231
- A sawtooth box.
2232
- """
2250
+ A box with a sawtooth outline.
2233
2251
2252
+ Parameters
2253
+ ----------
2254
+ pad : float, default: 0.3
2255
+ The amount of padding around the original box.
2256
+ tooth_size : float, default: *pad*/2
2257
+ Size of the sawtooth.
2258
+ """
2234
2259
def __init__ (self , pad = 0.3 , tooth_size = None ):
2235
- """
2236
- *pad*
2237
- amount of padding
2238
-
2239
- *tooth_size*
2240
- size of the sawtooth. pad* if None
2241
- """
2242
2260
self .pad = pad
2243
2261
self .tooth_size = tooth_size
2244
2262
super ().__init__ ()
@@ -2325,15 +2343,17 @@ def transmute(self, x0, y0, width, height, mutation_size):
2325
2343
2326
2344
@_register_style (_style_list )
2327
2345
class Roundtooth (Sawtooth ):
2328
- """A rounded tooth box."""
2329
- def __init__ (self , pad = 0.3 , tooth_size = None ):
2330
- """
2331
- *pad*
2332
- amount of padding
2346
+ """
2347
+ A box with a rounded sawtooth outline.
2333
2348
2334
- *tooth_size*
2335
- size of the sawtooth. pad* if None
2336
- """
2349
+ Parameters
2350
+ ----------
2351
+ pad : float, default: 0.3
2352
+ The amount of padding around the original box.
2353
+ tooth_size : float, default: *pad*/2
2354
+ Size of the sawtooth.
2355
+ """
2356
+ def __init__ (self , pad = 0.3 , tooth_size = None ):
2337
2357
super ().__init__ (pad , tooth_size )
2338
2358
2339
2359
def transmute (self , x0 , y0 , width , height , mutation_size ):
@@ -2364,7 +2384,7 @@ class FancyBboxPatch(Patch):
2364
2384
2365
2385
`.FancyBboxPatch` is similar to `.Rectangle`, but it draws a fancy box
2366
2386
around the rectangle. The transformation of the rectangle box to the
2367
- fancy box is delegated to the `.BoxTransmuterBase` and its derived classes .
2387
+ fancy box is delegated to the style classes defined in `.BoxStyle` .
2368
2388
"""
2369
2389
2370
2390
_edge_default = True
0 commit comments