8000 Update FancyBboxPatch docs to numpydoc style by timhoffm · Pull Request #14186 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Update FancyBboxPatch docs to numpydoc style #14186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 56 additions & 37 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -2437,14 +2437,12 @@ def transmute(self, x0, y0, width, height, mutation_size):

class FancyBboxPatch(Patch):
"""
A fancy box around a rectangle with lower left at *xy*=(*x*,
*y*) with specified width and height.

:class:`FancyBboxPatch` class is similar to :class:`Rectangle`
class, but it draws a fancy box around the rectangle. The
transformation of the rectangle box to the fancy box is delegated
to the :class:`BoxTransmuterBase` and its derived classes.
A fancy box around a rectangle with lower left at *xy* = (*x*, *y*)
with specified width and height.

`.FancyBboxPatch` is similar to `.Rectangle`, but it draws a fancy box
around the rectangle. The transformation of the rectangle box to the
fancy box is delegated to the `.BoxTransmuterBase` and its derived classes.
"""

_edge_default = True
Expand All @@ -2461,25 +2459,42 @@ def __init__(self, xy, width, height,
mutation_aspect=None,
**kwargs):
"""
*xy* = lower left corner
Parameters
----------
xy : float, float
The lower left corner of the box.

width : float
The width of the box.

*width*, *height*
height : float
The height of the box.

*boxstyle* determines what kind of fancy box will be drawn. It
can be a string of the style name with a comma separated
attribute, or an instance of :class:`BoxStyle`. Following box
styles are available.
boxstyle : str or `matplotlib.patches.BoxStyle`
The style of the fancy box. This can either be a `.BoxStyle`
instance or a string of the style name and optionally comma
seprarated attributes (e.g. "Round, pad=0.2"). This string is
passed to `.BoxStyle` to construct a `.BoxStyle` object. See
there for a full documentation.

%(AvailableBoxstyles)s
The following box styles are available:

*mutation_scale* : a value with which attributes of boxstyle
(e.g., pad) will be scaled. default=1.
%(AvailableBoxstyles)s

*mutation_aspect* : The height of the rectangle will be
squeezed by this value before the mutation and the mutated
box will be stretched by the inverse of it. default=None.
mutation_scale : float, optional, default: 1
Scaling factor applied to the attributes of the box style
(e.g. pad or rounding_size).
mutation_aspect : float, optional
The height of the rectangle will be squeezed by this value before
the mutation and the mutated box will be stretched by the inverse
of it. For example, this allows different horizontal and vertical
padding.

Other Parameters
----------------
**kwargs : `.Patch` properties

Valid kwargs are:
%(Patch)s
"""

Expand Down Expand Up @@ -2546,9 +2561,7 @@ def set_mutation_scale(self, scale):
self.stale = True

def get_mutation_scale(self):
"""
Return the mutation scale.
"""
"""Return the mutation scale."""
return self._mutation_scale

def set_mutation_aspect(self, aspect):
Expand All @@ -2563,20 +2576,15 @@ def set_mutation_aspect(self, aspect):
self.stale = True

def get_mutation_aspect(self):
"""
Return the aspect ratio of the bbox mutation.
"""
"""Return the aspect ratio of the bbox mutation."""
return self._mutation_aspect

def get_boxstyle(self):
"Return the boxstyle object"
"""Return the boxstyle object."""
return self._bbox_transmuter

def get_path(self):
"""
Return the mutated path of the rectangle
"""

"""Return the mutated path of the rectangle."""
_path = self.get_boxstyle()(self._x, self._y,
self._width, self._height,
self.get_mutation_scale(),
Expand All @@ -2586,19 +2594,19 @@ def get_path(self):
# Following methods are borrowed from the Rectangle class.

def get_x(self):
"Return the left coord of the rectangle"
"""Return the left coord of the rectangle."""
return self._x

def get_y(self):
"Return the bottom coord of the rectangle"
"""Return the bottom coord of the rectangle."""
return self._y

def get_width(self):
"Return the width of the rectangle"
"""Return the width of the rectangle."""
return self._width

def get_height(self):
"Return the height of the rectangle"
"""Return the height of the rectangle."""
return self._height

def set_x(self, x):
Expand Down Expand Up @@ -2647,9 +2655,19 @@ def set_height(self, h):

def set_bounds(self, *args):
"""
Set the bounds of the rectangle: l,b,w,h
Set the bounds of the rectangle.

ACCEPTS: (left, bottom, width, height)
Call signatures::

set_bounds(left, bottom, width, height)
set_bounds((left, bottom, width, height))

Parameters
----------
left, bottom : float
The coordinates of the bottom left corner of the rectangle.
width, height : float
The width/height of the rectangle.
"""
if len(args) == 1:
l, b, w, h = args[0]
Expand All @@ -2662,6 +2680,7 @@ def set_bounds(self, *args):
self.stale = True

def get_bbox(self):
"""Return the `.Bbox` of the rectangle."""
return transforms.Bbox.from_bounds(self._x, self._y,
self._width, self._height)

Expand Down
0