@@ -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,27 @@ 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
999
'steps-post'}
1000
+ Possible values:
1001
+
1002
+ - 'default': The points are connected with straight lines.
1003
+ - 'steps-pre', 'steps-mid', 'steps-post': The points are
1004
+ connected with step-like lines, i.e. horizontal lines with
1005
+ vertical steps.
1006
+ The postfix pre/mid/post determines the position of the vertical
1007
+ step (before the line segment, i.e. directly after the left
1008
+ point / halfway between the points / after the line segment,
1009
+ i.e. directly before the right point).
1010
+ - 'steps' is equal to 'steps-pre' and is maintained for
1011
+ backward-compatibility.
1012
+
991
1013
"""
992
1014
if drawstyle is None :
993
1015
drawstyle = 'default'
@@ -1001,7 +1023,7 @@ def set_drawstyle(self, drawstyle):
1001
1023
1002
1024
def set_linewidth (self , w ):
1003
1025
"""
1004
- Set the line width in points
1026
+ Set the line width in points.
1005
1027
1006
1028
Parameters
1007
1029
----------
@@ -1017,9 +1039,10 @@ def set_linewidth(self, w):
1017
1039
self ._us_dashOffset , self ._us_dashSeq , self ._linewidth )
1018
1040
1019
1041
def _split_drawstyle_linestyle (self , ls ):
1020
- '''Split drawstyle from linestyle string
1042
+ """
1043
+ Split drawstyle from linestyle string.
1021
1044
1022
- If `ls` is only a drawstyle default to returning a linestyle
1045
+ If *ls* is only a drawstyle default to returning a linestyle
1023
1046
of '-'.
1024
1047
1025
1048
Parameters
@@ -1035,48 +1058,43 @@ def _split_drawstyle_linestyle(self, ls):
1035
1058
1036
1059
ls : str
1037
1060
The linestyle with the drawstyle (if any) stripped.
1038
- '''
1061
+ """
1039
1062
for ds in self .drawStyleKeys : # long names are first in the list
1040
1063
if ls .startswith (ds ):
1041
1064
return ds , ls [len (ds ):] or '-'
1042
1065
return None , ls
1043
1066
1044
1067
def set_linestyle (self , ls ):
1045
1068
"""
1046
- Set the linestyle of the line (also accepts drawstyles,
1047
- e.g., ``'steps--'``)
1048
-
1049
-
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
- =========================== =================
1069
+ Set the linestyle of the line.
1061
1070
1062
- 'steps' is equivalent to 'steps-pre' and is maintained for
1063
- backward-compatibility.
1071
+ Parameters
1072
+ ----------
1073
+ ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
1074
+ Possible values:
1064
1075
1065
- Alternatively a dash tuple of the following form can be provided: :
1076
+ - A string :
1066
1077
1067
- (offset, onoffseq),
1078
+ =============================== =================
1079
+ Linestyle Description
1080
+ =============================== =================
1081
+ ``'-'`` or ``'solid'`` solid line
1082
+ ``'--'`` or ``'dashed'`` dashed line
1083
+ ``'-.'`` or ``'dashdot'`` dash-dotted line
1084
+ ``':'`` or ``'dotted'`` dotted line
1085
+ ``'None'`` or ``' '`` or ``''`` draw nothing
1086
+ =============================== =================
1068
1087
1069
- where ``onoffseq`` is an even length tuple of on and off ink in points.
1088
+ Optionally, the string may be preceded by a drawstyle, e.g.
1089
+ ``'steps--'``. See :meth:`set_drawstyle` for details.
1070
1090
1071
- .. seealso::
1091
+ - Alternatively a dash tuple of the following form can be
1092
+ provided::
1072
1093
1073
- :meth:`set_drawstyle`
1074
- To set the drawing style (stepping) of the plot.
1094
+ (offset, onoffseq)
1075
1095
1076
- Parameters
1077
- ----------
1078
- ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
1079
- The line style.
1096
+ where ``onoffseq`` is an even length tuple of on and off ink
1097
+ in points. See also :meth:`set_dashes`.
1080
1098
"""
1081
1099
if isinstance (ls , str ):
1082
1100
ds , ls = self ._split_drawstyle_linestyle (ls )
@@ -1110,7 +1128,7 @@ def set_marker(self, marker):
1110
1128
1111
1129
Parameters
1112
1130
----------
1113
- marker: marker style
1131
+ marker : marker style
1114
1132
See `~matplotlib.markers` for full description of possible
1115
1133
arguments.
1116
1134
"""
@@ -1213,13 +1231,19 @@ def set_ydata(self, y):
1213
1231
1214
1232
def set_dashes (self , seq ):
1215
1233
"""
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.
1234
+ Set the dash sequence.
1235
+
1236
+ The dash sequence is a sequence of floats of even length describing
1237
+ the length of dashes and spaces in points.
1238
+
1239
+ For example, (5, 2, 1, 2) describes a sequence of 5 point and 1 point
1240
+ dashes separated by 2 point spaces.
1219
1241
1220
1242
Parameters
1221
1243
----------
1222
1244
seq : sequence of floats (on/off ink in points) or (None, None)
1245
+ If *seq* is empty or ``(None, None)``, the linestyle will be set
1246
+ to solid.
1223
1247
"""
1224
1248
if seq == (None , None ) or len (seq ) == 0 :
1225
1249
self .set_linestyle ('-' )
@@ -1258,6 +1282,7 @@ def set_dash_joinstyle(self, s):
1258
1282
Parameters
1259
1283
----------
1260
1284
s : {'miter', 'round', 'bevel'}
1285
+ For examples see :doc:`/gallery/lines_bars_and_markers/joinstyle`.
1261
1286
"""
1262
1287
s = s .lower ()
1263
1288
if s not in self .validJoin :
@@ -1274,6 +1299,7 @@ def set_solid_joinstyle(self, s):
1274
1299
Parameters
1275
1300
----------
1276
1301
s : {'miter', 'round', 'bevel'}
1302
+ For examples see :doc:`/gallery/lines_bars_and_markers/joinstyle`.
1277
1303
"""
1278
1304
s = s .lower ()
1279
1305
if s not in self .validJoin :
@@ -1286,13 +1312,13 @@ def set_solid_joinstyle(self, s):
1286
1312
1287
1313
def get_dash_joinstyle (self ):
1288
1314
"""
1289
- Get the join style for dashed linestyles
1315
+ Get the join style for dashed linestyles.
1290
1316
"""
1291
1317
return self ._dashjoinstyle
1292
1318
1293
1319
def get_solid_joinstyle (self ):
1294
1320
"""
1295
- Get the join style for solid linestyles
1321
+ Get the join style for solid linestyles.
1296
1322
"""
1297
1323
return self ._solidjoinstyle
1298
1324
@@ -1330,18 +1356,18 @@ def set_solid_capstyle(self, s):
1330
1356
1331
1357
def get_dash_capstyle (self ):
1332
1358
"""
1333
- Get the cap style for dashed linestyles
1359
+ Get the cap style for dashed linestyles.
1334
1360
"""
1335
1361
return self ._dashcapstyle
1336
1362
1337
1363
def get_solid_capstyle (self ):
1338
1364
"""
1339
- Get the cap style for solid linestyles
1365
+ Get the cap style for solid linestyles.
1340
1366
"""
1341
1367
return self ._solidcapstyle
1342
1368
1343
1369
def is_dashed (self ):
1344
- 'return True if line is dashstyle'
1370
+ """Return whether line is dashstyle."""
1345
1371
return self ._linestyle in ('--' , '-.' , ':' )
1346
1372
1347
1373
0 commit comments