You are reading an old version of the documentation (v2.0.2). For the latest version see


This Page


Axes.eventplot(positions, orientation='horizontal', lineoffsets=1, linelengths=1, linewidths=None, colors=None, linestyles='solid', **kwargs)

Plot identical parallel lines at specific positions.

Plot parallel lines at the given positions. positions should be a 1D or 2D array-like object, with each row corresponding to a row or column of lines.

This type of plot is commonly used in neuroscience for representing neural events, where it is commonly called a spike raster, dot raster, or raster plot.

However, it is useful in any situation where you wish to show the timing or position of multiple sets of discrete events, such as the arrival times of people to a business on each day of the month or the date of hurricanes each year of the last century.

orientation : [ ‘horizontal’ | ‘vertical’ ]
‘horizontal’ : the lines will be vertical and arranged in rows ‘vertical’ : lines will be horizontal and arranged in columns
lineoffsets :
A float or array-like containing floats.
linelengths :
A float or array-like containing floats.
linewidths :
A float or array-like containing floats.
must be a sequence of RGBA tuples (e.g., arbitrary color strings, etc, not allowed) or a list of such sequences
linestyles :
[ ‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’ ] or an array of these values

For linelengths, linewidths, colors, and linestyles, if only a single value is given, that value is applied to all lines. If an array-like is given, it must have the same length as positions, and each value will be applied to the corresponding row or column in positions.

Returns a list of matplotlib.collections.EventCollection objects that were added.

kwargs are LineCollection properties:

Property Description
agg_filter unknown
alpha float or None
animated [True | False]
antialiased or antialiaseds Boolean or sequence of booleans
array unknown
axes an Axes instance
clim a length 2 sequence of floats
clip_box a matplotlib.transforms.Bbox instance
clip_on [True | False]
clip_path [ (Path, Transform) | Patch | None ]
cmap a colormap or registered colormap name
color matplotlib color arg or sequence of rgba tuples
contains a callable function
edgecolor or edgecolors matplotlib color spec or sequence of specs
facecolor or facecolors matplotlib color spec or sequence of specs
figure a matplotlib.figure.Figure instance
gid an id string
hatch [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
label string or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lw float or sequence of floats
norm unknown
offset_position unknown
offsets float or sequence of floats
path_effects unknown
paths unknown
picker [None|float|boolean|callable]
pickradius unknown
rasterized [True | False | None]
segments unknown
sketch_params unknown
snap unknown
transform Transform instance
url a url string
urls unknown
verts unknown
visible [True | False]
zorder any number


(Source code, png, pdf)



In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]:

  • All arguments with the following names: ‘colors’, ‘linelengths’, ‘lineoffsets’, ‘linestyles’, ‘linewidths’, ‘positions’.