8000 Merge pull request #10276 from timhoffm/axes-doc-step · matplotlib/matplotlib@5e6ce5c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e6ce5c

Browse files
authored
Merge pull request #10276 from timhoffm/axes-doc-step
improve docstring of Axes.step
2 parents 5ee9553 + b3fa851 commit 5e6ce5c

File tree

1 file changed

+54
-24
lines changed

1 file changed

+54
-24
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,37 +1928,63 @@ def step(self, x, y, *args, **kwargs):
19281928
"""
19291929
Make a step plot.
19301930
1931+
Call signatures::
1932+
1933+ 8000
step(x, y, [fmt], *, data=None, where='pre', **kwargs)
1934+
step(x, y, [fmt], x2, y2, [fmt2], ..., *, where='pre', **kwargs)
1935+
1936+
This is just a thin wrapper around `.plot` which changes some
1937+
formatting options. Most of the concepts and parameters of plot can be
1938+
used here as well.
1939+
19311940
Parameters
19321941
----------
19331942
x : array_like
1934-
1-D sequence, and it is assumed, but not checked,
1935-
that it is uniformly increasing.
1943+
1-D sequence of x positions. It is assumed, but not checked, that
1944+
it is uniformly increasing.
19361945
19371946
y : array_like
1938-
1-D sequence.
1947+
1-D sequence of y levels.
1948+
1949+
fmt : str, optional
1950+
A format string, e.g. 'g' for a green line. See `.plot` for a more
1951+
detailed description.
1952+
1953+
Note: While full format strings are accepted, it is recommended to
1954+
only specify the color. Line styles are currently ignored (use
1955+
the keyword argument *linestyle* instead). Markers are accepted
1956+
and plotted on the given positions, however, this is a rarely
1957+
needed feature for step plots.
1958+
1959+
data : indexable object, optional
1960+
An object with labelled data. If given, provide the label names to
1961+
plot in *x* and *y*.
1962+
1963+
where : {'pre', 'post', 'mid'}, optional, default 'pre'
1964+
Define where the steps should be placed:
1965+
1966+
- 'pre': The y value is continued constantly to the left from
1967+
every *x* position, i.e. the interval ``(x[i-1], x[i]]`` has the
1968+
value ``y[i]``.
1969+
- 'post': The y value is continued constantly to the right from
1970+
every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the
1971+
value ``y[i]``.
1972+
- 'mid': Steps occur half-way between the *x* positions.
19391973
19401974
Returns
19411975
-------
1942-
list
1943-
List of lines that were added.
1976+
lines
1977+
A list of `.Line2D` objects representing the plotted data.
19441978
19451979
Other Parameters
19461980
----------------
1947-
where : [ 'pre' | 'post' | 'mid' ]
1948-
If 'pre' (the default), the interval from
1949-
``x[i]`` to ``x[i+1]`` has level ``y[i+1]``.
1950-
1951-
If 'post', that interval has level ``y[i]``.
1952-
1953-
If 'mid', the jumps in *y* occur half-way between the
1954-
*x*-values.
1981+
**kwargs
1982+
Additional parameters are the same as those for `.plot`.
19551983
19561984
Notes
19571985
-----
1958-
Additional parameters are the same as those for
1959-
:func:`~matplotlib.pyplot.plot`.
1986+
.. [notes section required to get data note injection right]
19 10000 601987
"""
1961-
19621988
where = kwargs.pop('where', 'pre')
19631989
if where not in ('pre', 'post', 'mid'):
19641990
raise ValueError("'where' argument to step must be "
@@ -4994,10 +5020,12 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
49945020
step will occur:
49955021
49965022
- 'pre': The y value is continued constantly to the left from
4997-
every *x* position.
5023+
every *x* position, i.e. the interval ``(x[i-1], x[i]]`` has the
5024+
value ``y[i]``.
49985025
- 'post': The y value is continued constantly to the right from
4999-
every *x* position.
5000-
- 'mid': Steps occur in the middle between the *x* positions.
5026+
every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the
5027+
value ``y[i]``.
5028+
- 'mid': Steps occur half-way between the *x* positions.
50015029
50025030
Other Parameters
50035031
----------------
@@ -5175,11 +5203,13 @@ def fill_betweenx(self, y, x1, x2=0, where=None,
51755203
i.e. constant in between *y*. The value determines where the
51765204
step will occur:
51775205
5178-
- 'pre': The y value is continued constantly below every *y*
5179-
position.
5180-
- 'post': The y value is continued constantly above every *y*
5181-
position.
5182-
- 'mid': Steps occur in the middle between the *y* positions.
5206+
- 'pre': The y value is continued constantly to the left from
5207+
every *x* position, i.e. the interval ``(x[i-1], x[i]]`` has the
5208+
value ``y[i]``.
5209+
- 'post': The y value is continued constantly to the right from
5210+
every *x* position, i.e. the interval ``[x[i], x[i+1])`` has the
5211+
value ``y[i]``.
5212+
- 'mid': Steps occur half-way between the *x* positions.
51835213
51845214
Other Parameters
51855215
----------------

0 commit comments

Comments
 (0)
0