@@ -492,7 +492,7 @@ def contains(self, mouseevent):
492
492
return len (ind ) > 0 , dict (ind = ind )
493
493
494
494
def get_pickradius (self ):
495
- """return the pick radius used for containment tests"""
495
+ """Return the pick radius used for containment tests. """
496
496
return self .pickradius
497
497
498
498
def set_pickradius (self , d ):
@@ -507,18 +507,27 @@ def set_pickradius(self, d):
507
507
508
508
def get_fillstyle (self ):
509
509
"""
510
- return the marker fillstyle
510
+ Return the marker fillstyle.
511
511
"""
512
512
return self ._marker .get_fillstyle ()
513
513
514
514
def set_fillstyle (self , fs ):
515
515
"""
516
- Set the marker fill style; 'full' means fill the whole marker.
517
- 'none' means no filling; other options are for half-filled markers.
516
+ Set the marker fill style.
518
517
519
518
Parameters
520
519
----------
521
520
fs : {'full', 'left', 'right', 'bottom', 'top', 'none'}
521
+ Possible values:
522
+
523
+ - 'full': Fill the whole marker with the *markerfacecolor*.
524
+ - 'left', 'right', 'bottom', 'top': Fill the marker half at
525
+ the given side with the *markerfacecolor*. The other
526
+ half of the marker is filled with *markerfacecoloralt*.
527
+ - 'none': No filling.
528
+
529
+ For examples see
530
+ :doc:`/gallery/lines_bars_and_markers/marker_fillstyle_reference`.
522
531
"""
523
532
self ._marker .set_fillstyle (fs )
524
533
self .stale = True
@@ -576,7 +585,7 @@ def set_markevery(self, every):
576
585
self ._markevery = every
577
586
578
587
def get_markevery (self ):
579
- """return the markevery setting"""
588
+ """Return the markevery setting. """
580
589
return self ._markevery
581
590
582
591
def set_picker (self , p ):
@@ -619,7 +628,7 @@ def axes(self, ax):
619
628
620
629
def set_data (self , * args ):
621
630
"""
622
- Set the x and y data
631
+ Set the x and y data.
623
632
624
633
ACCEPTS: 2D array (rows are x, y) or two 1D arrays
625
634
"""
@@ -702,7 +711,7 @@ def _get_transformed_path(self):
702
711
703
712
def set_transform (self , t ):
704
713
"""
705
- set the Transformation instance used by this artist
714
+ Set the Transformation instance used by this artist.
706
715
707
716
Parameters
708
717
----------
@@ -714,13 +723,13 @@ def set_transform(self, t):
714
723
self .stale = True
715
724
716
725
def _is_sorted (self , x ):
717
- """return True if x is sorted in ascending order"""
726
+ """Return whether x is sorted in ascending order. """
718
727
# We don't handle the monotonically decreasing case.
719
728
return _path .is_sorted (x )
720
729
721
730
@allow_rasterization
722
731
def draw (self , renderer ):
723
- """draw the Line with ` renderer` unless visibility is False"""
732
+ """Draw the Line with * renderer* unless visibility is * False*. """
724
733
if not self .get_visible ():
725
734
return
726
735
@@ -851,9 +860,11 @@ def draw(self, renderer):
851
860
self .stale = False
852
861
853
862
def get_antialiased (self ):
863
+ """Return whether antialiased rendering is used."""
854
864
return self ._antialiased
855
865
856
866
def get_color (self ):
867
+ """Return the line color."""
857
868
return self ._color
858
869
859
870
def get_drawstyle (self ):
@@ -967,7 +978,7 @@ def set_antialiased(self, b):
967
978
968
979
def set_color (self , color ):
969
980
"""
970
- Set the color of the line
981
+ Set the color of the line.
971
982
972
983
Parameters
973
984
----------
@@ -978,16 +989,28 @@ def set_color(self, color):
978
989
979
990
def set_drawstyle (self , drawstyle ):
980
991
"""
981
- Set the drawstyle of the plot
992
+ Set the drawstyle of the plot.
982
993
983
- 'default' connects the points with lines. The steps variants
984
- produce step-plots. 'steps' is equivalent to 'steps-pre' and
985
- is maintained for backward-compatibility.
994
+ The drawstyle determines how the points are connected.
986
995
987
996
Parameters
988
997
----------
989
998
drawstyle : {'default', 'steps', 'steps-pre', 'steps-mid', \
990
- 'steps-post'}
999
+ 'steps-post'}, default: 'default'
1000
+ For 'default', the points are connected with straight lines.
1001
+
1002
+ The steps variants connect the points with step-like lines,
1003
+ i.e. horizontal lines with vertical steps. They differ in the
1004
+ location of the step:
1005
+
1006
+ - 'steps-pre': The step is at the beginning of the line segment,
1007
+ i.e. the line will be at the y-value of point to the right.
1008
+ - 'steps-mid': The step is halfway between the points.
1009
+ - 'steps-post: The step is at the end of the line segment,
1010
+ i.e. the line will be at the y-value of the point to the left.
1011
+ - 'steps' is equal to 'steps-pre' and is maintained for
1012
+ backward-compatibility.
1013
+
991
1014
"""
992
1015
if drawstyle is None :
993
1016
drawstyle = 'default'
@@ -1001,7 +1024,7 @@ def set_drawstyle(self, drawstyle):
1001
1024
1002
1025
def set_linewidth (self , w ):
1003
1026
"""
1004
- Set the line width in points
1027
+ Set the line width in points.
1005
1028
1006
1029
Parameters
1007
1030
----------
@@ -1017,9 +1040,10 @@ def set_linewidth(self, w):
1017
1040
self ._us_dashOffset , self ._us_dashSeq , self ._linewidth )
1018
1041
1019
1042
def _split_drawstyle_linestyle (self , ls ):
1020
- '''Split drawstyle from linestyle string
1043
+ """
1044
+ Split drawstyle from linestyle string.
1021
1045
1022
- If `ls` is only a drawstyle default to returning a linestyle
1046
+ If *ls* is only a drawstyle default to returning a linestyle
1023
1047
of '-'.
1024
1048
1025
1049
Parameters
@@ -1035,48 +1059,43 @@ def _split_drawstyle_linestyle(self, ls):
1035
1059
1036
1060
ls : str
1037
1061
The linestyle with the drawstyle (if any) stripped.
1038
- '''
1062
+ """
1039
1063
for ds in self .drawStyleKeys : # long names are first in the list
1040
1064
if ls .startswith (ds ):
1041
1065
return ds , ls [len (ds ):] or '-'
1042
1066
return None , ls
1043
1067
1044
1068
def set_linestyle (self , ls ):
1045
1069
"""
1046
- Set the linestyle of the line (also accepts drawstyles,
1047
- e.g., ``'steps--'``)
1048
-
1070
+ Set the linestyle of the line.
1049
1071
1050
- =========================== =================
1051
- linestyle description
1052
- =========================== =================
1053
- ``'-'`` or ``'solid'`` solid line
1054
- ``'--'`` or ``'dashed'`` dashed line
1055
- ``'-.'`` or ``'dashdot'`` dash-dotted line
1056
- ``':'`` or ``'dotted'`` dotted line
1057
- ``'None'`` draw nothing
1058
- ``' '`` draw nothing
1059
- ``''`` draw nothing
1060
- =========================== =================
1061
-
1062
- 'steps' is equivalent to 'steps-pre' and is maintained for
1063
- backward-compatibility.
1072
+ Parameters
1073
+ ----------
1074
+ ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
1075
+ Possible values:
1064
1076
1065
- Alternatively a dash tuple of the following form can be provided: :
1077
+ - A string :
1066
1078
1067
- (offset, onoffseq),
1079
+ =============================== =================
1080
+ Linestyle Description
1081
+ =============================== =================
1082
+ ``'-'`` or ``'solid'`` solid line
1083
+ ``'--'`` or ``'dashed'`` dashed line
1084
+ ``'-.'`` or ``'dashdot'`` dash-dotted line
1085
+ ``':'`` or ``'dotted'`` dotted line
1086
+ ``'None'`` or ``' '`` or ``''`` draw nothing
1087
+ =============================== =================
1068
1088
1069
- where ``onoffseq`` is an even length tuple of on and off ink in points.
1089
+ Optionally, the string may be preceded by a drawstyle, e.g.
1090
+ ``'steps--'``. See :meth:`set_drawstyle` for details.
1070
1091
1071
- .. seealso::
1092
+ - Alternatively a dash tuple of the following form can be
1093
+ provided::
1072
1094
1073
- :meth:`set_drawstyle`
1074
- To set the drawing style (stepping) of the plot.
1095
+ (offset, onoffseq)
1075
1096
1076
- Parameters
1077
- ----------
1078
- ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
1079
- The line style.
1097
+ where ``onoffseq`` is an even length tuple of on and off ink
1098
+ in points. See also :meth:`set_dashes`.
1080
1099
"""
1081
1100
if isinstance (ls , str ):
1082
1101
ds , ls = self ._split_drawstyle_linestyle (ls )
@@ -1110,7 +1129,7 @@ def set_marker(self, marker):
1110
1129
1111
1130
Parameters
1112
1131
----------
1113
- marker: marker style
1132
+ marker : marker style
1114
1133
See `~matplotlib.markers` for full description of possible
1115
1134
arguments.
1116
1135
"""
@@ -1213,13 +1232,19 @@ def set_ydata(self, y):
1213
1232
1214
1233
def set_dashes (self , seq ):
1215
1234
"""
1216
- Set the dash sequence, sequence of dashes with on off ink in
1217
- points. If seq is empty or if seq = (None, None), the
1218
- linestyle will be set to solid.
1235
+ Set the dash sequence.
1236
+
1237
+ The dash sequence is a sequence of floats of even length describing
1238
+ the length of dashes and spaces in points.
1239
+
1240
+ For example, (5, 2, 1, 2) describes a sequence of 5 point and 1 point
1241
+ dashes separated by 2 point spaces.
1219
1242
1220
1243
Parameters
1221
1244
----------
1222
1245
seq : sequence of floats (on/off ink in points) or (None, None)
1246
+ If *seq* is empty or ``(None, None)``, the linestyle will be set
1247
+ to solid.
1223
1248
"""
1224
1249
if seq == (None , None ) or len (seq ) == 0 :
1225
1250
self .set_linestyle ('-' )
@@ -1258,6 +1283,7 @@ def set_dash_joinstyle(self, s):
1258
1283
Parameters
1259
1284
----------
1260
1285
s : {'miter', 'round', 'bevel'}
1286
+ For examples see :doc:`/gallery/lines_bars_and_markers/joinstyle`.
1261
1287
"""
1262
1288
s = s .lower ()
1263
1289
if s not in self .validJoin :
@@ -1274,6 +1300,7 @@ def set_solid_joinstyle(self, s):
1274
1300
Parameters
1275
1301
----------
1276
1302
s : {'miter', 'round', 'bevel'}
1303
+ For examples see :doc:`/gallery/lines_bars_and_markers/joinstyle`.
1277
1304
"""
1278
1305
s = s .lower ()
1279
1306
if s not in self .validJoin :
@@ -1286,13 +1313,13 @@ def set_solid_joinstyle(self, s):
1286
1313
1287
1314
def get_dash_joinstyle (self ):
1288
1315
"""
1289
- Get the join style for dashed linestyles
1316
+ Get the join style for dashed linestyles.
1290
1317
"""
1291
1318
return self ._dashjoinstyle
1292
1319
1293
1320
def get_solid_joinstyle (self ):
1294
1321
"""
1295
- Get the join style for solid linestyles
1322
+ Get the join style for solid linestyles.
1296
1323
"""
1297
1324
return self ._solidjoinstyle
1298
1325
@@ -1330,18 +1357,18 @@ def set_solid_capstyle(self, s):
1330
1357
1331
1358
def get_dash_capstyle (self ):
1332
1359
"""
1333
- Get the cap style for dashed linestyles
1360
+ Get the cap style for dashed linestyles.
1334
1361
"""
1335
1362
return self ._dashcapstyle
1336
1363
1337
1364
def get_solid_capstyle (self ):
1338
1365
"""
1339
- Get the cap style for solid linestyles
1366
+ Get the cap style for solid linestyles.
1340
1367
"""
1341
1368
return self ._solidcapstyle
1342
1369
1343
1370
def is_dashed (self ):
1344
- 'return True if line is dashstyle'
1371
+ """Return whether line is dashstyle."""
1345
1372
return self ._linestyle in ('--' , '-.' , ':' )
1346
1373
1347
1374
0 commit comments