8000 Update FancyBboxPatch docs to numpydoc style · matplotlib/matplotlib@85c384a · GitHub
[go: up one dir, main page]

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 85c384a

Browse files
committed
Update FancyBboxPatch docs to numpydoc style
1 parent 959e9f3 commit 85c384a

File tree

1 file changed

+56
-37
lines changed

1 file changed

+56
-37
lines changed

lib/matplotlib/patches.py

Lines changed: 56 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,14 +2437,12 @@ def transmute(self, x0, y0, width, height, mutation_size):
24372437

24382438
class FancyBboxPatch(Patch):
24392439
"""
2440-
A fancy box around a rectangle with lower left at *xy*=(*x*,
2441-
*y*) with specified width and height.
2442-
2443-
:class:`FancyBboxPatch` class is similar to :class:`Rectangle`
2444-
class, but it draws a fancy box around the rectangle. The
2445-
transformation of the rectangle box to the fancy box is delegated
2446-
to the :class:`BoxTransmuterBase` and its derived classes.
2440+
A fancy box around a rectangle with lower left at *xy* = (*x*, *y*)
2441+
with specified width and height.
24472442
2443+
`.FancyBboxPatch` is similar to `.Rectangle`, but it draws a fancy box
2444+
around the rectangle. The transformation of the rectangle box to the
2445+
fancy box is delegated to the `.BoxTransmuterBase` and its derived classes.
24482446
"""
24492447

24502448
_edge_default = True
@@ -2461,25 +2459,42 @@ def __init__(self, xy, width, height,
24612459
mutation_aspect=None,
24622460
**kwargs):
24632461
"""
2464-
*xy* = lower left corner
2462+
Parameters
2463+
----------
2464+
xy : float, float
2465+
The lower left corner of the box.
2466+
2467+
width : float
2468+
The width of the box.
24652469
2466-
*width*, *height*
2470+
height : float
2471+
The height of the box.
24672472
2468-
*boxstyle* determines what kind of fancy box will be drawn. It
2469-
can be a string of the style name with a comma separated
2470-
attribute, or an instance of :class:`BoxStyle`. Following box
2471-
styles are available.
2473+
boxstyle : str or `matplotlib.patches.BoxStyle`
2474+
The style of the fancy box. This can either be a `.BoxStyle`
2475+
instance or a string of the style name and optionally comma
2476+
seprarated attributes (e.g. "Round, pad=0.2"). This string is
2477+
passed to `.BoxStyle` to construct a `.BoxStyle` object. See
2478+
there for a full documentation.
24722479
2473-
%(AvailableBoxstyles)s
2480+
The following box styles are available:
24742481
2475-
*mutation_scale* : a value with which attributes of boxstyle
2476-
(e.g., pad) will be scaled. default=1.
2482+
%(AvailableBoxstyles)s
24772483
2478-
*mutation_aspect* : The height of the rectangle will be
2479-
squeezed by this value before the mutation and the mutated
2480-
box will be stretched by the inverse of it. default=None.
2484+
mutation_scale : float, optional, default: 1
2485+
Scaling factor applied to the attributes of the box style
2486+
(e.g. pad or rounding_size).
2487+
2488+
mutation_aspect : float, optional
2489+
The height of the rectangle will be squeezed by this value before
2490+
the mutation and the mutated box will be stretched by the inverse
2491 8000 +
of it. For example, this allows different horizontal and vertical
2492+
padding.
2493+
2494+
Other Parameters
2495+
----------------
2496+
**kwargs : `.Patch` properties
24812497
2482-
Valid kwargs are:
24832498
%(Patch)s
24842499
"""
24852500

@@ -2546,9 +2561,7 @@ def set_mutation_scale(self, scale):
25462561
self.stale = True
25472562

25482563
def get_mutation_scale(self):
2549-
"""
2550-
Return the mutation scale.
2551-
"""
2564+
"""Return the mutation scale."""
25522565
return self._mutation_scale
25532566

25542567
def set_mutation_aspect(self, aspect):
@@ -2563,20 +2576,15 @@ def set_mutation_aspect(self, aspect):
25632576
self.stale = True
25642577

25652578
def get_mutation_aspect(self):
2566-
"""
2567-
Return the aspect ratio of the bbox mutation.
2568-
"""
2579+
"""Return the aspect ratio of the bbox mutation."""
25692580
return self._mutation_aspect
25702581

25712582
def get_boxstyle(self):
2572-
"Return the boxstyle object"
2583+
"""Return the boxstyle object."""
25732584
return self._bbox_transmuter
25742585

25752586
def get_path(self):
2576-
"""
2577-
Return the mutated path of the rectangle
2578-
"""
2579-
2587+
"""Return the mutated path of the rectangle."""
25802588
_path = self.get_boxstyle()(self._x, self._y,
25812589
self._width, self._height,
25822590
self.get_mutation_scale(),
@@ -2586,19 +2594,19 @@ def get_path(self):
25862594
# Following methods are borrowed from the Rectangle class.
25872595

25882596
def get_x(self):
2589-
"Return the left coord of the rectangle"
2597+
"""Return the left coord of the rectangle."""
25902598
return self._x
25912599

25922600
def get_y(self):
2593-
"Return the bottom coord of the rectangle"
2601+
"""Return the bottom coord of the rectangle."""
25942602
return self._y
25952603

25962604
def get_width(self):
2597-
"Return the width of the rectangle"
2605+
"""Return the width of the rectangle."""
25982606
return self._width
25992607

26002608
def get_height(self):
2601-
"Return the height of the rectangle"
2609+
"""Return the height of the rectangle."""
26022610
return self._height
26032611

26042612
def set_x(self, x):
@@ -2647,9 +2655,19 @@ def set_height(self, h):
26472655

26482656
def set_bounds(self, *args):
26492657
"""
2650-
Set the bounds of the rectangle: l,b,w,h
2658+
Set the bounds of the rectangle.
26512659
2652-
ACCEPTS: (left, bottom, width, height)
2660+
Call signatures::
2661+
2662+
set_bounds(left, bottom, width, height)
2663+
set_bounds((left, bottom, width, height))
2664+
2665+
Parameters
2666+
----------
2667+
left, bottom : float
2668+
The coordinates of the bottom left corner of the rectangle.
2669+
width, height : float
2670+
The width/height of the rectangle.
26532671
"""
26542672
if len(args) == 1:
26552673
l, b, w, h = args[0]
@@ -2662,6 +2680,7 @@ def set_bounds(self, *args):
26622680
self.stale = True
26632681

26642682
def get_bbox(self):
2683+
"""Return the `.Bbox` of the rectangle."""
26652684
return transforms.Bbox.from_bounds(self._x, self._y,
26662685
self._width, self._height)
26672686

0 commit comments

Comments
 (0)
0