matplotlib.pyplot.stairs#

matplotlib.pyplot.stairs(values,edges=None,*,orientation='vertical',baseline=0,fill=False,data=None,**kwargs)[source]#

Draw a stepwise constant function as a line or a filled plot.

edges define the x-axis positions of the steps.values the function valuesbetween these steps. Depending onfill, the function is drawn either as acontinuous line with vertical segments at the edges, or as a filled area.

Parameters:
valuesarray-like

The step heights.

edgesarray-like

The step positions, withlen(edges)==len(vals)+1,between which the curve takes on vals values.

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

The direction of the steps. Vertical means thatvalues are alongthe y-axis, and edges are along the x-axis.

baselinefloat, array-like or None, default: 0

The bottom value of the bounding edges or whenfill=True, position of lower edge. Iffill isTrue or an array is passed tobaseline, a closedpath is drawn.

If None, then drawn as an unclosed Path.

fillbool, default: False

Whether the area under the step curve should be filled.

Passing bothfill=True`and``baseline=None will likely result inundesired filling: the first and last points will be connectedwith a straight line and the fill will be between this line and the stairs.

Returns:
StepPatchStepPatch
Other Parameters:
dataindexable object, optional

If given, all parameters also accept a strings, which isinterpreted asdata[s] ifs is a key indata.

**kwargs

StepPatch properties

Notes

Note

This is thepyplot wrapper foraxes.Axes.stairs.

Examples usingmatplotlib.pyplot.stairs#

Stairs Demo

Stairs Demo