MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / step

Method step

lib/matplotlib/axes/_axes.py:2138–2204  ·  view source on GitHub ↗

Make a step plot. 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 `.plot` which changes some formatting options. Mo

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

Source from the content-addressed store, hash-verified

2136
2137 # @_preprocess_data() # let 'plot' do the unpacking..
2138 def step(self, x, y, *args, where='pre', data=None, **kwargs):
2139 """
2140 Make a step plot.
2141
2142 Call signatures::
2143
2144 step(x, y, [fmt], *, data=None, where='pre', **kwargs)
2145 step(x, y, [fmt], x2, y2, [fmt2], ..., *, where='pre', **kwargs)
2146
2147 This is just a thin wrapper around `.plot` which changes some
2148 formatting options. Most of the concepts and parameters of plot can be
2149 used here as well.
2150
2151 .. note::
2152
2153 This method uses a standard plot with a step drawstyle: The *x*
2154 values are the reference positions and steps extend left/right/both
2155 directions depending on *where*.
2156
2157 For the common case where you know the values and edges of the
2158 steps, use `~.Axes.stairs` instead.
2159
2160 Parameters
2161 ----------
2162 x : array-like
2163 1D sequence of x positions. It is assumed, but not checked, that
2164 it is uniformly increasing.
2165
2166 y : array-like
2167 1D sequence of y levels.
2168
2169 fmt : str, optional
2170 A format string, e.g. 'g' for a green line. See `.plot` for a more
2171 detailed description.
2172
2173 Note: While full format strings are accepted, it is recommended to
2174 only specify the color. Line styles are currently ignored (use
2175 the keyword argument *linestyle* instead). Markers are accepted
2176 and plotted on the given positions, however, this is a rarely
2177 needed feature for step plots.
2178
2179 where : {'pre', 'post', 'mid'}, default: 'pre'
2180 Define where the steps should be placed:
2181
2182 - 'pre': The y value is continued constantly to the left from
2183 every *x* position, i.e. the interval ``(x[i-1], x[i]]`` has the
2184 value ``y[i]``.
2185 - 'post': The y value is continued constantly to the right from
2186 every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the
2187 value ``y[i]``.
2188 - 'mid': Steps occur half-way between the *x* positions.
2189
2190 data : indexable object, optional
2191 An object with labelled data. If given, provide the label names to
2192 plot in *x* and *y*.
2193
2194 **kwargs
2195 Additional parameters are the same as those for `.plot`.

Callers 7

stepFunction · 0.80
test_stepMethod · 0.80
test_step_linestyleFunction · 0.80
test_2dcolor_plotFunction · 0.80
test_step_markersFunction · 0.80
stairs_demo.pyFile · 0.80
step_demo.pyFile · 0.80

Calls 1

plotMethod · 0.95

Tested by 4

test_stepMethod · 0.64
test_step_linestyleFunction · 0.64
test_2dcolor_plotFunction · 0.64
test_step_markersFunction · 0.64