@@ -1890,26 +1890,24 @@ class BoxStyle(_Style):
18901890
18911891 class _Base :
18921892 """
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`.
18991894
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+ """
19031908
19041909 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."""
19131911 raise NotImplementedError ('Derived must override' )
19141912
19151913 def __call__ (self , x0 , y0 , width , height , mutation_size ,
@@ -1918,9 +1916,18 @@ def __call__(self, x0, y0, width, height, mutation_size,
19181916 Given the location and size of the box, return the path of
19191917 the box around it.
19201918
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`
19241931 """
19251932 # The __call__ method is a thin wrapper around the transmute method
19261933 # and takes care of the aspect.
@@ -1940,15 +1947,14 @@ def __call__(self, x0, y0, width, height, mutation_size,
19401947 @_register_style (_style_list )
19411948 class Square (_Base ):
19421949 """
1943- A simple square box.
1944- """
1950+ A square box.
19451951
1952+ Parameters
1953+ ----------
1954+ pad : float, default: 0.3
1955+ The amount of padding around the original box.
1956+ """
19461957 def __init__ (self , pad = 0.3 ):
1947- """
1948- Parameters
1949- ----------
1950- pad : float
1951- """
19521958 self .pad = pad
19531959 super ().__init__ ()
19541960
@@ -1968,14 +1974,15 @@ def transmute(self, x0, y0, width, height, mutation_size):
19681974
19691975 @_register_style (_style_list )
19701976 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+ """
19721985 def __init__ (self , pad = 0.3 ):
1973- """
1974- Parameters
1975- ----------
1976- pad : float
1977- The amount of padding around the original box.
1978- """
19791986 self .pad = pad
19801987 super ().__init__ ()
19811988
@@ -1991,7 +1998,12 @@ def transmute(self, x0, y0, width, height, mutation_size):
19911998 @_register_style (_style_list )
19921999 class LArrow (_Base ):
19932000 """
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.
19952007 """
19962008 def __init__ (self , pad = 0.3 ):
19972009 self .pad = pad
@@ -2029,9 +2041,13 @@ def transmute(self, x0, y0, width, height, mutation_size):
20292041 @_register_style (_style_list )
20302042 class RArrow (LArrow ):
20312043 """
2032- (right) Arrow Box
2033- """
2044+ A box in the shape of a right-pointing arrow.
20342045
2046+ Parameters
2047+ ----------
2048+ pad : float, default: 0.3
2049+ The amount of padding around the original box.
2050+ """
20352051 def __init__ (self , pad = 0.3 ):
20362052 super ().__init__ (pad )
20372053
@@ -2044,7 +2060,12 @@ def transmute(self, x0, y0, width, height, mutation_size):
20442060 @_register_style (_style_list )
20452061 class DArrow (_Base ):
20462062 """
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.
20482069 """
20492070 # This source is copied from LArrow,
20502071 # modified to add a right arrow to the bbox.
@@ -2095,16 +2116,15 @@ def transmute(self, x0, y0, width, height, mutation_size):
20952116 class Round (_Base ):
20962117 """
20972118 A box with round corners.
2098- """
20992119
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+ """
21002127 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- """
21082128 self .pad = pad
21092129 self .rounding_size = rounding_size
21102130 super ().__init__ ()
@@ -2156,17 +2176,16 @@ def transmute(self, x0, y0, width, height, mutation_size):
21562176 @_register_style (_style_list )
21572177 class Round4 (_Base ):
21582178 """
2159- Another box with round edges.
2160- """
2179+ A box with rounded edges.
21612180
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+ """
21622188 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- """
21702189 self .pad = pad
21712190 self .rounding_size = rounding_size
21722191 super ().__init__ ()
@@ -2209,17 +2228,16 @@ def transmute(self, x0, y0, width, height, mutation_size):
22092228 @_register_style (_style_list )
22102229 class Sawtooth (_Base ):
22112230 """
2212- A sawtooth box.
2213- """
2231+ A box with a sawtooth outline.
22142232
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+ """
22152240 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- """
22232241 self .pad = pad
22242242 self .tooth_size = tooth_size
22252243 super ().__init__ ()
@@ -2306,15 +2324,17 @@ def transmute(self, x0, y0, width, height, mutation_size):
23062324
23072325 @_register_style (_style_list )
23082326 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.
23142329
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 ):
23182338 super ().__init__ (pad , tooth_size )
23192339
23202340 def transmute (self , x0 , y0 , width , height , mutation_size ):
@@ -2345,7 +2365,7 @@ class FancyBboxPatch(Patch):
23452365
23462366 `.FancyBboxPatch` is similar to `.Rectangle`, but it draws a fancy box
23472367 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` .
23492369 """
23502370
23512371 _edge_default = True
0 commit comments