matplotlib.patches.StepPatch#

classmatplotlib.patches.StepPatch(values,edges,*,orientation='vertical',baseline=0,**kwargs)[source]#

Bases:PathPatch

A path patch describing a stepwise constant function.

By default, the path is not closed and starts and stops atbaseline value.

Parameters:
valuesarray-like

The step heights.

edgesarray-like

The edge 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 arealong the 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.

**kwargs

Patch properties:

Property

Description

agg_filter

a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image

alpha

unknown

animated

bool

antialiased oraa

bool or None

capstyle

CapStyle or {'butt', 'projecting', 'round'}

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

color

color

edgecolor orec

color or None

edgegapcolor

color or None

facecolor orfc

color or None

figure

Figure orSubFigure

fill

bool

gid

str

hatch

{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}

hatch_linewidth

unknown

hatchcolor

color or 'edge' or None

in_layout

bool

joinstyle

JoinStyle or {'miter', 'round', 'bevel'}

label

object

linestyle orls

{'-', '--', '-.', ':', '', ...} or (offset, on-off-seq)

linewidth orlw

float or None

mouseover

bool

path_effects

list ofAbstractPathEffect

picker

None or bool or float or callable

rasterized

bool

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

transform

Transform

url

str

visible

bool

zorder

float

get_data()[source]#

GetStepPatch values, edges and baseline as namedtuple.

set(*,agg_filter=<UNSET>,alpha=<UNSET>,animated=<UNSET>,antialiased=<UNSET>,capstyle=<UNSET>,clip_box=<UNSET>,clip_on=<UNSET>,clip_path=<UNSET>,color=<UNSET>,data=<UNSET>,edgecolor=<UNSET>,edgegapcolor=<UNSET>,facecolor=<UNSET>,fill=<UNSET>,gid=<UNSET>,hatch=<UNSET>,hatch_linewidth=<UNSET>,hatchcolor=<UNSET>,in_layout=<UNSET>,joinstyle=<UNSET>,label=<UNSET>,linestyle=<UNSET>,linewidth=<UNSET>,mouseover=<UNSET>,path=<UNSET>,path_effects=<UNSET>,picker=<UNSET>,rasterized=<UNSET>,sketch_params=<UNSET>,snap=<UNSET>,transform=<UNSET>,url=<UNSET>,visible=<UNSET>,zorder=<UNSET>)[source]#

Set multiple properties at once.

a.set(a=A,b=B,c=C)

is equivalent to

a.set_a(A)a.set_b(B)a.set_c(C)

In addition to the full property names, aliases are also supported, e.g.set(lw=2) is equivalent toset(linewidth=2), but it is an errorto pass both simultaneously.

The order of the individual setter calls matches the order of parametersinset(). However, most properties do not depend on each other sothat order is rarely relevant.

Supported properties are

Property

Description

agg_filter

a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image

alpha

float or None

animated

bool

antialiased oraa

bool or None

capstyle

CapStyle or {'butt', 'projecting', 'round'}

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

color

color

data

1D array-like or None

edgecolor orec

color or None

edgegapcolor

color or None

facecolor orfc

color or None

figure

Figure orSubFigure

fill

bool

gid

str

hatch

{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}

hatch_linewidth

unknown

hatchcolor

color or 'edge' or None

in_layout

bool

joinstyle

JoinStyle or {'miter', 'round', 'bevel'}

label

object

linestyle orls

{'-', '--', '-.', ':', '', ...} or (offset, on-off-seq)

linewidth orlw

float or None

mouseover

bool

path

unknown

path_effects

list ofAbstractPathEffect

picker

None or bool or float or callable

rasterized

bool

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

transform

Transform

url

str

visible

bool

zorder

float

set_data(values=None,edges=None,baseline=None)[source]#

SetStepPatch values, edges and baseline.

Parameters:
values1D array-like or None

Will not update values, if passing None

edges1D array-like, optional
baselinefloat, 1D array-like or None

Examples usingmatplotlib.patches.StepPatch#

Stairs Demo

Stairs Demo