8000 Merge pull request #15228 from timhoffm/doc-clean · matplotlib/matplotlib@cf406b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf406b7

Browse files
authored
Merge pull request #15228 from timhoffm/doc-clean
Minor docstring style cleanup
2 parents 30ee939 + 2064bd6 commit cf406b7

File tree

1 file changed

+29
-49
lines changed

1 file changed

+29
-49
lines changed

lib/matplotlib/patches.py

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def __init__(self,
9797

9898
def get_verts(self):
9999
"""
100-
Return a copy of the vertices used in this patch
100+
Return a copy of the vertices used in this patch.
101101
102102
If the patch contains Bezier curves, the curves will be
103103
interpolated by line segments. To access the curves as
@@ -230,9 +230,7 @@ def contains_points(self, points, radius=None):
230230
radius)
231231

232232
def update_from(self, other):
233-
"""
234-
Updates this :class:`Patch` from the properties of *other*.
235-
"""
233+
"""Updates this `.Patch` from the properties of *other*."""
236234
artist.Artist.update_from(self, other)
237235
# For some properties we don't need or don't want to go through the
238236
# getters/setters, so we just copy them directly.
@@ -280,33 +278,23 @@ def get_patch_transform(self):
280278
return transforms.IdentityTransform()
281279

282280
def get_antialiased(self):
283-
"""
284-
Returns True if the :class:`Patch` is to be drawn with antialiasing.
285-
"""
281+
"""Return whether antialiasing is used for drawing."""
286282
return self._antialiased
287283

288284
def get_edgecolor(self):
289-
"""
290-
Return the edge color of the :class:`Patch`.
291-
"""
285+
"""Return the edge color."""
292286
return self._edgecolor
293287

294288
def get_facecolor(self):
295-
"""
296-
Return the face color of the :class:`Patch`.
297-
"""
289+
"""Return the face color."""
298290
return self._facecolor
299291

300292
def get_linewidth(self):
301-
"""
302-
Return the line width in points.
303-
"""
293+
"""Return the line width in points."""
304294
return self._linewidth
305295

306296
def get_linestyle(self):
307-
"""
308-
Return the linestyle.
309-
"""
297+
"""Return the linestyle."""
310298
return self._linestyle
311299

312300
def set_antialiased(self, aa):
@@ -467,7 +455,7 @@ def get_fill(self):
467455

468456
def set_capstyle(self, s):
469457
"""
470-
Set the patch capstyle
458+
Set the capstyle.
471459
472460
Parameters
473461
----------
@@ -479,12 +467,11 @@ def set_capstyle(self, s):
479467
self.stale = True
480468

481469
def get_capstyle(self):
482-
"Return the current capstyle"
470+
"""Return the capstyle."""
483471
return self._capstyle
484472

485473
def set_joinstyle(self, s):
486-
"""
487-
Set the patch joinstyle
474+
"""Set the joinstyle.
488475
489476
Parameters
490477
----------
@@ -496,12 +483,12 @@ def set_joinstyle(self, s):
496483
self.stale = True
497484

498485
def get_joinstyle(self):
499-
"Return the current joinstyle"
486+
"""Return the joinstyle."""
500487
return self._joinstyle
501488

502489
def set_hatch(self, hatch):
503490
r"""
504-
Set the hatching pattern
491+
Set the hatching pattern.
505492
506493
*hatch* can be one of::
507494
@@ -531,7 +518,7 @@ def set_hatch(self, hatch):
531518
self.stale = True
532519

533520
def get_hatch(self):
534-
'Return the current hatching pattern'
521+
"""Return the hatching pattern."""
535522
return self._hatch
536523

537524
@contextlib.contextmanager
@@ -595,7 +582,7 @@ def _bind_draw_path_function(self, renderer):
595582

596583
@artist.allow_rasterization
597584
def draw(self, renderer):
598-
'Draw the :class:`Patch` to the given *renderer*.'
585+
"""Draw to the given *renderer*."""
599586
if not self.get_visible():
600587
return
601588

@@ -613,21 +600,17 @@ def draw(self, renderer):
613600
self._facecolor if self._facecolor[3] else None)
614601

615602
def get_path(self):
616-
"""
617-
Return the path of this patch
618-
"""
603+
"""Return the path of this patch."""
619604
raise NotImplementedError('Derived must override')
620605

621606
def get_window_extent(self, renderer=None):
622607
return self.get_path().get_extents(self.get_transform())
623608

624609
def _convert_xy_units(self, xy):
625-
"""
626-
Convert x and y units for a tuple (x, y)
627-
"""
610+
"""Convert x and y units for a tuple (x, y)."""
628611
x = self.convert_xunits(xy[0])
629612
y = self.convert_yunits(xy[1])
630-
return (x, y)
613+
return x, y
631614

632615

633616
patchdoc = artist.kwdoc(Patch)
@@ -755,9 +738,7 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
755738
self._rect_transform = transforms.IdentityTransform()
756739

757740
def get_path(self):
758-
"""
759-
Return the vertices of the rectangle.
760-
"""
741+
"""Return the vertices of the rectangle."""
761742
return Path.unit_rectangle()
762743

763744
def _update_patch_transform(self):
@@ -783,9 +764,7 @@ def _update_y1(self):
783764
self._y1 = self._y0 + self._height
784765

785766
def _convert_units(self):
786-
"""
787-
Convert bounds of the rectangle.
788-
"""
767+
"""Convert bounds of the rectangle."""
789768
x0 = self.convert_xunits(self._x0)
790769
y0 = self.convert_yunits(self._y0)
791770
x1 = self.convert_xunits(self._x1)
@@ -797,40 +776,40 @@ def get_patch_transform(self):
797776
return self._rect_transform
798777

799778
def get_x(self):
800-
"Return the left coord of the rectangle."
779+
"""Return the left coordinate of the rectangle."""
801780
return self._x0
802781

803782
def get_y(self):
804-
"Return the bottom coord of the rectangle."
783+
"""Return the bottom coordinate of the rectangle."""
805784
return self._y0
806785

807786
def get_xy(self):
808-
"Return the left and bottom coords of the rectangle."
787+
"""Return the left and bottom coords of the rectangle as a tuple."""
809788
return self._x0, self._y0
810789

811790
def get_width(self):
812-
"Return the width of the rectangle."
791+
"""Return the width of the rectangle."""
813792
return self._width
814793

815794
def get_height(self):
816-
"Return the height of the rectangle."
795+
"""Return the height of the rectangle."""
817796
return self._height
818797

819798
def set_x(self, x):
820-
"Set the left coord of the rectangle."
799+
"""Set the left coordinate of the rectangle."""
821800
self._x0 = x
822801
self._update_x1()
823802
self.stale = True
824803

825804
def set_y(self, y):
826-
"Set the bottom coord of the rectangle."
805+
"""Set the bottom coordinate of the rectangle."""
827806
self._y0 = y
828807
self._update_y1()
829808
self.stale = True
830809

831810
def set_xy(self, xy):
832811
"""
833-
Set the left and bottom coords of the rectangle.
812+
Set the left and bottom coordinates of the rectangle.
834813
835814
Parameters
836815
----------
@@ -877,6 +856,7 @@ def set_bounds(self, *args):
877856
self.stale = True
878857

879858
def get_bbox(self):
859+
"""Return the `.Bbox`."""
880860
x0, y0, x1, y1 = self._convert_units()
881861
return transforms.Bbox.from_extents(x0, y0, x1, y1)
882862

@@ -2634,7 +2614,7 @@ def set_bounds(self, *args):
26342614
self.stale = True
26352615

26362616
def get_bbox(self):
2637-
"""Return the `.Bbox` of the rectangle."""
2617+
"""Return the `.Bbox`."""
26382618
return transforms.Bbox.from_bounds(self._x, self._y,
26392619
self._width, self._height)
26402620

0 commit comments

Comments
 (0)
0