@@ -1890,26 +1890,24 @@ class BoxStyle(_Style):
1890
1890
1891
1891
class _Base :
1892
1892
"""
1893
- :class:`BBoxTransmuterBase` and its derivatives are used to make a
1894
- fancy box around a given rectangle. The :meth:`__call__` method
1895
- returns the :class:`~matplotlib.path.Path` of the fancy box. This
1896
- class is not an artist and actual drawing of the fancy box is done
1897
- by the :class:`FancyBboxPatch` class.
1898
- """
1893
+ Abstract base class for styling of `.FancyBboxPatch`.
1899
1894
1900
- # The derived classes are required to be able to be initialized
1901
- # w/o arguments, i.e., all its argument (except self) must have
1902
- # the default values.
1895
+ This class is not an artist itself. The `__call__` method returns the
1896
+ `~matplotlib.path.Path` for outlining the fancy box. The actual drawing
1897
+ is handled in `.FancyBboxPatch`.
1898
+
1899
+ Subclasses may only use parameters with default values in their
1900
+ ``__init__`` method because they must be able to be initialized
1901
+ without arguments.
1902
+
1903
+ Subclasses must implement the `transmute` method. It receives the
1904
+ enclosing rectangle *x0, y0, width, height* as well as the
1905
+ *mutation_size*, which scales the outline properties such as padding.
1906
+ It returns the outline of the fancy box as `.path.Path`.
1907
+ """
1903
1908
1904
1909
def transmute (self , x0 , y0 , width , height , mutation_size ):
1905
- """
1906
- The transmute method is a very core of the
1907
- :class:`BboxTransmuter` class and must be overridden in the
1908
- subclasses. It receives the location and size of the
1909
- rectangle, and the mutation_size, with which the amount of
1910
- padding and etc. will be scaled. It returns a
1911
- :class:`~matplotlib.path.Path` instance.
1912
- """
1910
+ """Return the `~.path.Path` outlining the given rectangle."""
1913
1911
raise NotImplementedError ('Derived must override' )
1914
1912
1915
1913
def __call__ (self , x0 , y0 , width , height , mutation_size ,
@@ -1918,9 +1916,18 @@ def __call__(self, x0, y0, width, height, mutation_size,
1918
1916
Given the location and size of the box, return the path of
1919
1917
the box around it.
1920
1918
1921
- - *x0*, *y0*, *width*, *height* : location and size of the box
1922
- - *mutation_size* : a reference scale for the mutation.
1923
- - *aspect_ratio* : aspect-ration for the mutation.
1919
+ Parameters
1920
+ ----------
1921
+ x0, y0, width, height : float
1922
+ Location and size of the box.
1923
+ mutation_size : float
1924
+ A reference scale for the mutation.
1925
+ aspect_ratio : float, default: 1
1926
+ Aspect-ratio for the mutation.
1927
+
1928
+ Returns
1929
+ -------
1930
+ path : `~matplotlib.path.Path`
1924
1931
"""
1925
1932
# The __call__ method is a thin wrapper around the transmute method
1926
1933
# and takes care of the aspect.
@@ -1940,15 +1947,14 @@ def __call__(self, x0, y0, width, height, mutation_size,
1940
1947
@_register_style (_style_list )
1941
1948
class Square (_Base ):
1942
1949
"""
1943
- A simple square box.
1944
- """
1950
+ A square box.
1945
1951
1952
+ Parameters
1953
+ ----------
1954
+ pad : float, default: 0.3
1955
+ The amount of padding around the original box.
1956
+ """
1946
1957
def __init__ (self , pad = 0.3 ):
1947
- """
1948
- Parameters
1949
- ----------
1950
- pad : float
1951
- """
1952
1958
self .pad = pad
1953
1959
super ().__init__ ()
1954
1960
@@ -1968,14 +1974,15 @@ def transmute(self, x0, y0, width, height, mutation_size):
1968
1974
1969
1975
@_register_style (_style_list )
1970
1976
class Circle (_Base ):
1971
- """A simple circle box."""
1977
+ """
1978
+ A circular box.
1979
+
1980
+ Parameters
1981
+ ----------
1982
+ pad : float, default: 0.3
1983
+ The amount of padding around the original box.
1984
+ """
1972
1985
def __init__ (self , pad = 0.3 ):
1973
- """
1974
- Parameters
1975
- ----------
1976
- pad : float
1977
- The amount of padding around the original box.
1978
- """
1979
1986
self .pad = pad
1980
1987
super ().__init__ ()
1981
1988
@@ -1991,7 +1998,12 @@ def transmute(self, x0, y0, width, height, mutation_size):
1991
1998
@_register_style (_style_list )
1992
1999
class LArrow (_Base ):
1993
2000
"""
1994
- (left) Arrow Box
2001
+ A box in the shape of a left-pointing arrow.
2002
+
2003
+ Parameters
2004
+ ----------
2005
+ pad : float, default: 0.3
2006
+ The amount of padding around the original box.
1995
2007
"""
1996
2008
def __init__ (self , pad = 0.3 ):
1997
2009
self .pad = pad
@@ -2029,9 +2041,13 @@ def transmute(self, x0, y0, width, height, mutation_size):
2029
2041
@_register_style (_style_list )
2030
2042
class RArrow (LArrow ):
2031
2043
"""
2032
- (right) Arrow Box
2033
- """
2044
+ A box in the shape of a right-pointing arrow.
2034
2045
2046
+ Parameters
2047
+ ----------
2048
+ pad : float, default: 0.3
2049
+ The amount of padding around the original box.
2050
+ """
2035
2051
def __init__ (self , pad = 0.3 ):
2036
2052
super ().__init__ (pad )
2037
2053
@@ -2044,7 +2060,12 @@ def transmute(self, x0, y0, width, height, mutation_size):
2044
2060
@_register_style (_style_list )
2045
2061
class DArrow (_Base ):
2046
2062
"""
2047
- (Double) Arrow Box
2063
+ A box in the shape of a two-way arrow.
2064
+
2065
+ Parameters
2066
+ ----------
2067
+ pad : float, default: 0.3
2068
+ The amount of padding around the original box.
2048
2069
"""
2049
2070
# This source is copied from LArrow,
2050
2071
# modified to add a right arrow to the bbox.
@@ -2095,16 +2116,15 @@ def transmute(self, x0, y0, width, height, mutation_size):
2095
2116
class Round (_Base ):
2096
2117
"""
2097
2118
A box with round corners.
2098
- """
2099
2119
2120
+ Parameters
2121
+ ----------
2122
+ pad : float, default: 0.3
2123
+ The amount of padding around the original box.
2124
+ rounding_size : float, default: *pad*
2125
+ Radius of the corners.
2126
+ """
2100
2127
def __init__ (self , pad = 0.3 , rounding_size = None ):
2101
- """
2102
- *pad*
2103
- amount of padding
2104
-
2105
- *rounding_size*
2106
- rounding radius of corners. *pad* if None
2107
- """
2108
2128
self .pad = pad
2109
2129
self .rounding_size = rounding_size
2110
2130
super ().__init__ ()
@@ -2156,17 +2176,16 @@ def transmute(self, x0, y0, width, height, mutation_size):
2156
2176
@_register_style (_style_list )
2157
2177
class Round4 (_Base ):
2158
2178
"""
2159
- Another box with round edges.
2160
- """
2179
+ A box with rounded edges.
2161
2180
2181
+ Parameters
2182
+ ----------
2183
+ pad : float, default: 0.3
2184
+ The amount of padding around the original box.
2185
+ rounding_size : float, default: *pad*/2
2186
+ Rounding of edges.
2187
+ """
2162
2188
def __init__ (self , pad = 0.3 , rounding_size = None ):
2163
- """
2164
- *pad*
2165
- amount of padding
2166
-
2167
- *rounding_size*
2168
- rounding size of edges. *pad* if None
2169
- """
2170
2189
self .pad = pad
2171
2190
self .rounding_size = rounding_size
2172
2191
super ().__init__ ()
@@ -2209,17 +2228,16 @@ def transmute(self, x0, y0, width, height, mutation_size):
2209
2228
@_register_style (_style_list )
2210
2229
class Sawtooth (_Base ):
2211
2230
"""
2212
- A sawtooth box.
2213
- """
2231
+ A box with a sawtooth outline.
2214
2232
2233
+ Parameters
2234
+ ----------
2235
+ pad : float, default: 0.3
2236
+ The amount of padding around the original box.
2237
+ tooth_size : float, default: *pad*/2
2238
+ Size of the sawtooth.
2239
+ """
2215
2240
def __init__ (self , pad = 0.3 , tooth_size = None ):
2216
- """
2217
- *pad*
2218
- amount of padding
2219
-
2220
- *tooth_size*
2221
- size of the sawtooth. pad* if None
2222
- """
2223
2241
self .pad = pad
2224
2242
self .tooth_size = tooth_size
2225
2243
super ().__init__ ()
@@ -2306,15 +2324,17 @@ def transmute(self, x0, y0, width, height, mutation_size):
2306
2324
2307
2325
@_register_style (_style_list )
2308
2326
class Roundtooth (Sawtooth ):
2309
- """A rounded tooth box."""
2310
- def __init__ (self , pad = 0.3 , tooth_size = None ):
2311
- """
2312
- *pad*
2313
- amount of padding
2327
+ """
2328
+ A box with a rounded sawtooth outline.
2314
2329
2315
- *tooth_size*
2316
- size of the sawtooth. pad* if None
2317
- """
2330
+ Parameters
2331
+ ----------
2332
+ pad : float, default: 0.3
2333
+ The amount of padding around the original box.
2334
+ tooth_size : float, default: *pad*/2
2335
+ Size of the sawtooth.
2336
+ """
2337
+ def __init__ (self , pad = 0.3 , tooth_size = None ):
2318
2338
super ().__init__ (pad , tooth_size )
2319
2339
2320
2340
def transmute (self , x0 , y0 , width , height , mutation_size ):
@@ -2345,7 +2365,7 @@ class FancyBboxPatch(Patch):
2345
2365
2346
2366
`.FancyBboxPatch` is similar to `.Rectangle`, but it draws a fancy box
2347
2367
around the rectangle. The transformation of the rectangle box to the
2348
- fancy box is delegated to the `.BoxTransmuterBase` and its derived classes .
2368
+ fancy box is delegated to the style classes defined in `.BoxStyle` .
2349
2369
"""
2350
2370
2351
2371
_edge_default = True
0 commit comments