Skip to content

Commit 43b5c17

Browse files
committed
More docstring cleanup of Line2D.
1 parent 76fe3ab commit 43b5c17

File tree

1 file changed

+108
-20
lines changed

1 file changed

+108
-20
lines changed

lib/matplotlib/lines.py

Lines changed: 108 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,18 @@ def contains(self, mouseevent):
436436
:meth:`~matplotlib.lines.Line2D.set_pickradius` to view or
437437
modify it.
438438
439-
Returns *True* if any values are within the radius along with
440-
``{'ind': pointlist}``, where *pointlist* is the set of points
441-
within the radius.
439+
Parameters
440+
----------
441+
mouseevent : `matplotlib.backend_bases.MouseEvent`.
442442
443-
TODO: sort returned indices by distance
443+
Returns
444+
-------
445+
contains : bool
446+
Whether any values are within the radius.
447+
``{'ind': pointlist}``
448+
Where *pointlist* is the set of points within the radius.
449+
450+
TODO: sort returned indices by distance
444451
"""
445452
if callable(self._contains):
446453
return self._contains(self, mouseevent)
@@ -492,12 +499,18 @@ def contains(self, mouseevent):
492499
return len(ind) > 0, dict(ind=ind)
493500

494501
def get_pickradius(self):
495-
"""Return the pick radius used for containment tests."""
502+
"""
503+
Return the pick radius used for containment tests.
504+
505+
See `.contains` for more details.
506+
"""
496507
return self.pickradius
497508

498509
def set_pickradius(self, d):
499510
"""Set the pick radius used for containment tests.
500511
512+
See `.contains` for more details.
513+
501514
Parameters
502515
----------
503516
d : float
@@ -507,7 +520,9 @@ def set_pickradius(self, d):
507520

508521
def get_fillstyle(self):
509522
"""
510-
Return the marker fillstyle.
523+
Return the marker fill style.
524+
525+
See also `.set_fillstyle`.
511526
"""
512527
return self._marker.get_fillstyle()
513528

@@ -585,7 +600,11 @@ def set_markevery(self, every):
585600
self._markevery = every
586601

587602
def get_markevery(self):
588-
"""Return the markevery setting."""
603+
"""
604+
Return the markevery setting for marker subsampling.
605+
606+
See also `.set_markevery`.
607+
"""
589608
return self._markevery
590609

591610
def set_picker(self, p):
@@ -715,7 +734,7 @@ def set_transform(self, t):
715734
716735
Parameters
717736
----------
718-
t : matplotlib.transforms.Transform
737+
t : `matplotlib.transforms.Transform`
719738
"""
720739
Artist.set_transform(self, t)
721740
self._invalidx = True
@@ -729,7 +748,15 @@ def _is_sorted(self, x):
729748

730749
@allow_rasterization
731750
def draw(self, renderer):
732-
"""Draw the Line with *renderer* unless visibility is *False*."""
751+
"""
752+
Draw the Line using the given renderer.
753+
754+
This does not have any effect if the line is not `.visible`.
755+
756+
Parameters
757+
----------
758+
renderer : `.RendererBase` subclass.
759+
"""
733760
if not self.get_visible():
734761
return
735762

@@ -864,22 +891,51 @@ def get_antialiased(self):
864891
return self._antialiased
865892

866893
def get_color(self):
867-
"""Return the line color."""
894+
"""
895+
Return the line color.
896+
897+
See also `.set_color`.
898+
"""
868899
return self._color
869900

870901
def get_drawstyle(self):
902+
"""
903+
Return the drawstyle.
904+
905+
See also `.set_drawstyle`.
906+
"""
871907
return self._drawstyle
872908

873909
def get_linestyle(self):
910+
"""
911+
Return the linestyle.
912+
913+
See also `.set_linestyle`.
914+
"""
874915
return self._linestyle
875916

876917
def get_linewidth(self):
918+
"""
919+
Return the linewidth in points.
920+
921+
See also `.set_linewidth`.
922+
"""
877923
return self._linewidth
878924

879925
def get_marker(self):
926+
"""
927+
Return the line marker.
928+
929+
See also `.set_marker`.
930+
"""
880931
return self._marker.get_marker()
881932

882933
def get_markeredgecolor(self):
934+
"""
935+
Return the marker edge color.
936+
937+
See also `.set_markeredgecolor`.
938+
"""
883939
mec = self._markeredgecolor
884940
if cbook._str_equal(mec, 'auto'):
885941
if rcParams['_internal.classic_mode']:
@@ -892,6 +948,11 @@ def get_markeredgecolor(self):
892948
return mec
893949

894950
def get_markeredgewidth(self):
951+
"""
952+
Return the marker edge width in points.
953+
954+
See also `.set_markeredgewidth`.
955+
"""
895956
return self._markeredgewidth
896957

897958
def _get_markerfacecolor(self, alt=False):
@@ -905,12 +966,27 @@ def _get_markerfacecolor(self, alt=False):
905966
return fc
906967

907968
def get_markerfacecolor(self):
969+
"""
970+
Return the marker face color.
971+
972+
See also `.set_markerfacecolor`.
973+
"""
908974
return self._get_markerfacecolor(alt=False)
909975

910976
def get_markerfacecoloralt(self):
977+
"""
978+
Return the alternate marker face color.
979+
980+
See also `.set_markerfacecoloralt`.
981+
"""
911982
return self._get_markerfacecolor(alt=True)
912983

913984
def get_markersize(self):
985+
"""
986+
Return the marker size in points.
987+
988+
See also `.set_markersize`.
989+
"""
914990
return self._markersize
915991

916992
def get_data(self, orig=True):
@@ -1252,7 +1328,7 @@ def set_dashes(self, seq):
12521328
self.set_linestyle((0, seq))
12531329

12541330
def update_from(self, other):
1255-
"""copy properties from other to self"""
1331+
"""Copy properties from other to self."""
12561332
Artist.update_from(self, other)
12571333
self._linestyle = other._linestyle
12581334
self._linewidth = other._linewidth
@@ -1278,7 +1354,7 @@ def update_from(self, other):
12781354

12791355
def set_dash_joinstyle(self, s):
12801356
"""
1281-
Set the join style for dashed linestyles.
1357+
Set the join style for dashed lines.
12821358
12831359
Parameters
12841360
----------
@@ -1295,7 +1371,7 @@ def set_dash_joinstyle(self, s):
12951371

12961372
def set_solid_joinstyle(self, s):
12971373
"""
1298-
Set the join style for solid linestyles.
1374+
Set the join style for solid lines.
12991375
13001376
Parameters
13011377
----------
@@ -1313,19 +1389,23 @@ def set_solid_joinstyle(self, s):
13131389

13141390
def get_dash_joinstyle(self):
13151391
"""
1316-
Get the join style for dashed linestyles.
1392+
Return the join style for dashed lines.
1393+
1394+
See also `.set_dash_joinstyle`.
13171395
"""
13181396
return self._dashjoinstyle
13191397

13201398
def get_solid_joinstyle(self):
13211399
"""
1322-
Get the join style for solid linestyles.
1400+
Return the join style for solid lines.
1401+
1402+
See also `.set_solid_joinstyle`.
13231403
"""
13241404
return self._solidjoinstyle
13251405

13261406
def set_dash_capstyle(self, s):
13271407
"""
1328-
Set the cap style for dashed linestyles.
1408+
Set the cap style for dashed lines.
13291409
13301410
Parameters
13311411
----------
@@ -1341,7 +1421,7 @@ def set_dash_capstyle(self, s):
13411421

13421422
def set_solid_capstyle(self, s):
13431423
"""
1344-
Set the cap style for solid linestyles.
1424+
Set the cap style for solid lines.
13451425
13461426
Parameters
13471427
----------
@@ -1357,18 +1437,26 @@ def set_solid_capstyle(self, s):
13571437

13581438
def get_dash_capstyle(self):
13591439
"""
1360-
Get the cap style for dashed linestyles.
1440+
Return the cap style for dashed lines.
1441+
1442+
See also `.set_dash_capstyle`.
13611443
"""
13621444
return self._dashcapstyle
13631445

13641446
def get_solid_capstyle(self):
13651447
"""
1366-
Get the cap style for solid linestyles.
1448+
Return the cap style for solid lines.
1449+
1450+
See also `.set_solid_capstyle`.
13671451
"""
13681452
return self._solidcapstyle
13691453

13701454
def is_dashed(self):
1371-
"""Return whether line is dashstyle."""
1455+
"""
1456+
Return whether line has a dashed linestyle.
1457+
1458+
See also `.set_linestyle`.
1459+
"""
13721460
return self._linestyle in ('--', '-.', ':')
13731461

13741462

0 commit comments

Comments
 (0)