@@ -1083,53 +1083,85 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
1083
1083
linelengths = 1 , linewidths = None , colors = None ,
1084
1084
linestyles = 'solid' , ** kwargs ):
1085
1085
"""
1086
- Plot identical parallel lines at specific positions.
1086
+ Plot identical parallel lines at the given positions.
1087
1087
1088
- Plot parallel lines at the given positions. positions should be a 1D
1089
- or 2D array-like object, with each row corresponding to a row or column
1090
- of lines.
1088
+ *positions* should be a 1D or 2D array-like object, with each row
1089
+ corresponding to a row or column of lines.
1091
1090
1092
1091
This type of plot is commonly used in neuroscience for representing
1093
- neural events, where it is commonly called a spike raster, dot raster,
1092
+ neural events, where it is usually called a spike raster, dot raster,
1094
1093
or raster plot.
1095
1094
1096
1095
However, it is useful in any situation where you wish to show the
1097
1096
timing or position of multiple sets of discrete events, such as the
1098
1097
arrival times of people to a business on each day of the month or the
1099
1098
date of hurricanes each year of the last century.
1100
1099
1101
- *orientation* : [ 'horizontal' | 'vertical' ]
1102
- 'horizontal' : the lines will be vertical and arranged in rows
1103
- 'vertical' : lines will be horizontal and arranged in columns
1100
+ Parameters
1101
+ ----------
1102
+ positions : 1D or 2D array-like object
1103
+ Each value is an event. If *positions* is a 2D array-like, each
1104
+ row corresponds to a row or a column of lines (depending on the
1105
+ *orientation* parameter).
1106
+
1107
+ orientation : {'horizontal', 'vertical'}, optional
1108
+ Controls the direction of the event collections:
1104
1109
1105
- *lineoffsets* :
1106
- A float or array-like containing floats.
1110
+ - 'horizontal' : the lines are arranged horizontally in rows,
1111
+ and are vertical.
1112
+ - 'vertical' : the lines are arranged vertically in columns,
1113
+ and are horizontal.
1107
1114
1108
- *linelengths* :
1109
- A float or array-like containing floats.
1115
+ lineoffsets : scalar or sequence of scalars, optional, default: 1
1116
+ The offset of the center of the lines from the origin, in the
1117
+ direction orthogonal to *orientation*.
1110
1118
1111
- *linewidths* :
1112
- A float or array-like containing floats.
1119
+ linelengths : scalar or sequence of scalars, optional, default: 1
1120
+ The total height of the lines (i.e. the lines stretches from
1121
+ ``lineoffset - linelength/2`` to ``lineoffset + linelength/2``).
1113
1122
1114
- *colors*
1115
- must be a sequence of RGBA tuples (e.g., arbitrary color
1116
- strings, etc, not allowed) or a list of such sequences
1123
+ linewidths : scalar, scalar sequence or None, optional, default: None
1124
+ The line width(s) of the event lines, in points. If it is None,
1125
+ defaults to its rcParams setting.
1117
1126
1118
- *linestyles* :
1119
- [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ] or an array of these
1120
- values
1127
+ colors : color, sequence of colors or None, optional, default: None
1128
+ The color(s) of the event lines. If it is None, defaults to its
1129
+ rcParams setting.
1121
1130
1122
- For linelengths, linewidths, colors, and linestyles, if only a single
1123
- value is given, that value is applied to all lines. If an array-like
1124
- is given, it must have the same length as positions, and each value
1125
- will be applied to the corresponding row or column in positions.
1131
+ linestyles : str or tuple or a sequence of such values, optional
1132
+ Default is 'solid'. Valid strings are ['solid', 'dashed',
1133
+ 'dashdot', 'dotted', '-', '--', '-.', ':']. Dash tuples
1134
+ should be of the form::
1126
1135
1127
- Returns a list of :class:`matplotlib.collections.EventCollection`
1128
- objects that were added.
1136
+ (offset, onoffseq),
1129
1137
1130
- kwargs are :class:`~matplotlib.collections.LineCollection` properties:
1138
+ where *onoffseq* is an even length tuple of on and off ink
1139
+ in points.
1140
+
1141
+ **kwargs : optional
1142
+ Other keyword arguments are line collection properties. See
1143
+ :class:`~matplotlib.collections.LineCollection` for a list of
1144
+ the valid properties.
1145
+
1146
+ Returns
1147
+ -------
1148
+
1149
+ A list of :class:`matplotlib.collections.EventCollection` objects that
1150
+ were added.
1151
+
1152
+ Notes
1153
+ -----
1154
+
1155
+ For *linelengths*, *linewidths*, *colors*, and *linestyles*, if only
1156
+ a single value is given, that value is applied to all lines. If an
1157
+ array-like is given, it must have the same length as *positions*, and
1158
+ each row of the array will be applied to the corresponding row or
1159
+ column of events.
1160
+
1161
+ Example
1162
+ -------
1131
1163
1132
- %(LineCollection)s
1164
+ .. plot:: mpl_examples/pylab_examples/eventplot_demo.py
1133
1165
"""
1134
1166
self ._process_unit_info (xdata = positions ,
1135
1167
ydata = [lineoffsets , linelengths ],
0 commit comments