matplotlib 3.5.1

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

This type of plot is commonly used in neuroscience for representing neural events, where it is usually 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.

Notes

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 of the array.

Parameters

positions : array-like or list of array-like

A 1D array-like defines the positions of one sequence of events.

Multiple groups of events may be passed as a list of array-likes. Each group can be styled independently by passing lists of values to lineoffsets, linelengths, linewidths, colors and linestyles.

Note that positions can be a 2D array, but in practice different event groups usually have different counts so that one will use a list of different-length arrays rather than a 2D array.

orientation : {'horizontal', 'vertical'}, default: 'horizontal'

The direction of the event sequence:

  • 'horizontal': the events are arranged horizontally. The indicator lines are vertical.

  • 'vertical': the events are arranged vertically. The indicator lines are horizontal.

lineoffsets : float or array-like, default: 1

The offset of the center of the lines from the origin, in the direction orthogonal to orientation.

If positions is 2D, this can be a sequence with length matching the length of positions.

linelengths : float or array-like, default: 1

The total height of the lines (i.e. the lines stretches from lineoffset - linelength/2 to lineoffset + linelength/2 ).

If positions is 2D, this can be a sequence with length matching the length of positions.

linewidths : float or array-like, default: :rc:`lines.linewidth`

The line width(s) of the event lines, in points.

If positions is 2D, this can be a sequence with length matching the length of positions.

colors : color or list of colors, default: :rc:`lines.color`

The color(s) of the event lines.

If positions is 2D, this can be a sequence with length matching the length of positions.

linestyles : str or tuple or list of such values, default: 'solid'

Default is 'solid'. Valid strings are ['solid', 'dashed', 'dashdot', 'dotted', '-', '--', '-.', ':']. Dash tuples should be of the form:

(offset, onoffseq),

where onoffseq is an even length tuple of on and off ink in points.

If positions is 2D, this can be a sequence with length matching the length of positions.

data : indexable object, optional

If given, the following parameters also accept a string s , which is interpreted as data[s] (unless this raises an exception):

positions, lineoffsets, linelengths, linewidths, colors, linestyles

**kwargs :

Other keyword arguments are line collection properties. See .LineCollection for a list of the valid properties.

Returns

list of `.EventCollection`

The .EventCollection that were added.

Plot identical parallel lines at the given positions.

Examples

.. plot:: gallery/lines_bars_and_markers/eventplot_demo.py
    
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

matplotlib.pyplot.plotting

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/pyplot.py#2518
type: <class 'function'>
Commit: