Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 751f78c

Browse filesBrowse files
tacaswellMeeseeksDev[bot]
authored andcommitted
Backport PR #14186: Update FancyBboxPatch docs to numpydoc style
1 parent a06e364 commit 751f78c
Copy full SHA for 751f78c

File tree

Expand file treeCollapse file tree

1 file changed

+56
-37
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+56
-37
lines changed

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+56-37Lines changed: 56 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2454,14 +2454,12 @@ def transmute(self, x0, y0, width, height, mutation_size):
24542454

24552455
class FancyBboxPatch(Patch):
24562456
"""
2457-
A fancy box around a rectangle with lower left at *xy*=(*x*,
2458-
*y*) with specified width and height.
2459-
2460-
:class:`FancyBboxPatch` class is similar to :class:`Rectangle`
2461-
class, but it draws a fancy box around the rectangle. The
2462-
transformation of the rectangle box to the fancy box is delegated
2463-
to the :class:`BoxTransmuterBase` and its derived classes.
2457+
A fancy box around a rectangle with lower left at *xy* = (*x*, *y*)
2458+
with specified width and height.
24642459
2460+
`.FancyBboxPatch` is similar to `.Rectangle`, but it draws a fancy box
2461+
around the rectangle. The transformation of the rectangle box to the
2462+
fancy box is delegated to the `.BoxTransmuterBase` and its derived classes.
24652463
"""
24662464

24672465
_edge_default = True
@@ -2478,25 +2476,42 @@ def __init__(self, xy, width, height,
24782476
mutation_aspect=None,
24792477
**kwargs):
24802478
"""
2481-
*xy* = lower left corner
2479+
Parameters
2480+
----------
2481+
xy : float, float
2482+
The lower left corner of the box.
2483+
2484+
width : float
2485+
The width of the box.
24822486
2483-
*width*, *height*
2487+
height : float
2488+
The height of the box.
24842489
2485-
*boxstyle* determines what kind of fancy box will be drawn. It
2486-
can be a string of the style name with a comma separated
2487-
attribute, or an instance of :class:`BoxStyle`. Following box
2488-
styles are available.
2490+
boxstyle : str or `matplotlib.patches.BoxStyle`
2491+
The style of the fancy box. This can either be a `.BoxStyle`
2492+
instance or a string of the style name and optionally comma
2493+
seprarated attributes (e.g. "Round, pad=0.2"). This string is
2494+
passed to `.BoxStyle` to construct a `.BoxStyle` object. See
2495+
there for a full documentation.
24892496
2490-
%(AvailableBoxstyles)s
2497+
The following box styles are available:
24912498
2492-
*mutation_scale* : a value with which attributes of boxstyle
2493-
(e.g., pad) will be scaled. default=1.
2499+
%(AvailableBoxstyles)s
24942500
2495-
*mutation_aspect* : The height of the rectangle will be
2496-
squeezed by this value before the mutation and the mutated
2497-
box will be stretched by the inverse of it. default=None.
2501+
mutation_scale : float, optional, default: 1
2502+
Scaling factor applied to the attributes of the box style
2503+
(e.g. pad or rounding_size).
2504+
2505+
mutation_aspect : float, optional
2506+
The height of the rectangle will be squeezed by this value before
2507+
the mutation and the mutated box will be stretched by the inverse
2508+
of it. For example, this allows different horizontal and vertical
2509+
padding.
2510+
2511+
Other Parameters
2512+
----------------
2513+
**kwargs : `.Patch` properties
24982514
2499-
Valid kwargs are:
25002515
%(Patch)s
25012516
"""
25022517

@@ -2563,9 +2578,7 @@ def set_mutation_scale(self, scale):
25632578
self.stale = True
25642579

25652580
def get_mutation_scale(self):
2566-
"""
2567-
Return the mutation scale.
2568-
"""
2581+
"""Return the mutation scale."""
25692582
return self._mutation_scale
25702583

25712584
def set_mutation_aspect(self, aspect):
@@ -2580,20 +2593,15 @@ def set_mutation_aspect(self, aspect):
25802593
self.stale = True
25812594

25822595
def get_mutation_aspect(self):
2583-
"""
2584-
Return the aspect ratio of the bbox mutation.
2585-
"""
2596+
"""Return the aspect ratio of the bbox mutation."""
25862597
return self._mutation_aspect
25872598

25882599
def get_boxstyle(self):
2589-
"Return the boxstyle object"
2600+
"""Return the boxstyle object."""
25902601
return self._bbox_transmuter
25912602

25922603
def get_path(self):
2593-
"""
2594-
Return the mutated path of the rectangle
2595-
"""
2596-
2604+
"""Return the mutated path of the rectangle."""
25972605
_path = self.get_boxstyle()(self._x, self._y,
25982606
self._width, self._height,
25992607
self.get_mutation_scale(),
@@ -2603,19 +2611,19 @@ def get_path(self):
26032611
# Following methods are borrowed from the Rectangle class.
26042612

26052613
def get_x(self):
2606-
"Return the left coord of the rectangle"
2614+
"""Return the left coord of the rectangle."""
26072615
return self._x
26082616

26092617
def get_y(self):
2610-
"Return the bottom coord of the rectangle"
2618+
"""Return the bottom coord of the rectangle."""
26112619
return self._y
26122620

26132621
def get_width(self):
2614-
"Return the width of the rectangle"
2622+
"""Return the width of the rectangle."""
26152623
return self._width
26162624

26172625
def get_height(self):
2618-
"Return the height of the rectangle"
2626+
"""Return the height of the rectangle."""
26192627
return self._height
26202628

26212629
def set_x(self, x):
@@ -2664,9 +2672,19 @@ def set_height(self, h):
26642672

26652673
def set_bounds(self, *args):
26662674
"""
2667-
Set the bounds of the rectangle: l,b,w,h
2675+
Set the bounds of the rectangle.
26682676
2669-
ACCEPTS: (left, bottom, width, height)
2677+
Call signatures::
2678+
2679+
set_bounds(left, bottom, width, height)
2680+
set_bounds((left, bottom, width, height))
2681+
2682+
Parameters
2683+
----------
2684+
left, bottom : float
2685+
The coordinates of the bottom left corner of the rectangle.
2686+
width, height : float
2687+
The width/height of the rectangle.
26702688
"""
26712689
if len(args) == 1:
26722690
l, b, w, h = args[0]
@@ -2679,6 +2697,7 @@ def set_bounds(self, *args):
26792697
self.stale = True
26802698

26812699
def get_bbox(self):
2700+
"""Return the `.Bbox` of the rectangle."""
26822701
return transforms.Bbox.from_bounds(self._x, self._y,
26832702
self._width, self._height)
26842703

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.