matplotlib 3.5.1

ParametersReturnsBackRef
step(x, y, *args, where='pre', data=None, **kwargs)

Call signatures:

step(x, y, [fmt], *, data=None, where='pre', **kwargs)
step(x, y, [fmt], x2, y2, [fmt2], ..., *, where='pre', **kwargs)

This is just a thin wrapper around :None:None:`.plot` which changes some formatting options. Most of the concepts and parameters of plot can be used here as well.

note

This method uses a standard plot with a step drawstyle: The x values are the reference positions and steps extend left/right/both directions depending on where.

For the common case where you know the values and edges of the steps, use :None:None:`~.Axes.stairs` instead.

Parameters

x : array-like

1D sequence of x positions. It is assumed, but not checked, that it is uniformly increasing.

y : array-like

1D sequence of y levels.

fmt : str, optional

A format string, e.g. 'g' for a green line. See :None:None:`.plot` for a more detailed description.

Note: While full format strings are accepted, it is recommended to only specify the color. Line styles are currently ignored (use the keyword argument linestyle instead). Markers are accepted and plotted on the given positions, however, this is a rarely needed feature for step plots.

where : {'pre', 'post', 'mid'}, default: 'pre'

Define where the steps should be placed:

  • 'pre': The y value is continued constantly to the left from every x position, i.e. the interval (x[i-1], x[i]] has the value y[i] .

  • 'post': The y value is continued constantly to the right from every x position, i.e. the interval [x[i], x[i+1]) has the value y[i] .

  • 'mid': Steps occur half-way between the x positions.

data : indexable object, optional

An object with labelled data. If given, provide the label names to plot in x and y.

**kwargs :

Additional parameters are the same as those for :None:None:`.plot`.

Returns

list of `.Line2D`

Objects representing the plotted data.

Make a step plot.

Examples

See :

Back References

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

scipy.signal._ltisys.dstep matplotlib.pyplot.plotting scipy.signal._ltisys.dimpulse

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#2882
type: <class 'function'>
Commit: