Skip to content

Improve plot() docstring. #12772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):

Call signatures::

plot([x], y, [fmt], data=None, **kwargs)
plot([x], y, [fmt], *, data=None, **kwargs)
plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs)

The coordinates of the points or line nodes are given by *x*, *y*.
Expand All @@ -1359,6 +1359,7 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):

When conflicting with *fmt*, keyword arguments take precedence.


**Plotting labelled data**

There's a convenient way for plotting objects with labelled data (i.e.
Expand Down Expand Up @@ -1406,19 +1407,19 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
Alternatively, you can also change the style cycle using the
'axes.prop_cycle' rcParam.


Parameters
----------
x, y : array-like or scalar
The horizontal / vertical coordinates of the data points.
*x* values are optional. If not given, they default to
``[0, ..., N-1]``.
*x* values are optional and default to `range(len(y))`.

Commonly, these parameters are arrays of length N. However,
scalars are supported as well (equivalent to an array with
constant value).
Commonly, these parameters are 1D arrays.

The parameters can also be 2-dimensional. Then, the columns
represent separate data sets.
They can also be scalars, or two-dimensional (in that case, the
columns represent separate data sets).

These arguments cannot be passed as keywords.

fmt : str, optional
A format string, e.g. 'ro' for red circles. See the *Notes*
Expand All @@ -1428,6 +1429,8 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
basic line properties. All of these and more can also be
controlled by keyword arguments.

This argument cannot be passed as keyword.

data : indexable object, optional
An object with labelled data. If given, provide the label names to
plot in *x* and *y*.
Expand Down