8000 Update docs on Axes.set_prop_cycle · matplotlib/matplotlib@c5b290d · GitHub
[go: up one dir, main page]

Skip to content

Commit c5b290d

Browse files
committed
Update docs on Axes.set_prop_cycle
1 parent e54939a commit c5b290d

File tree

1 file changed

+30
-13
lines changed

1 file changed

+30
-13
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,40 +1173,57 @@ def _set_title_offset_trans(self, title_offset_points):
11731173

11741174
def set_prop_cycle(self, *args, **kwargs):
11751175
"""
1176-
Set the property cycle for any future plot commands on this Axes.
1176+
Set the property cycle of the Axes.
11771177
1178-
set_prop_cycle(arg)
1179-
set_prop_cycle(label, itr)
1180-
set_prop_cycle(label1=itr1[, label2=itr2[, ...]])
1178+
The property cycle controls the style properties such as color,
1179+
marker and linestyle of future plot commands. The style properties
1180+
of data already added to the Axes are not modified.
1181+
1182+
Call signatures::
1183+
1184+
set_prop_cycle(cycler)
1185+
set_prop_cycle(label, values)
1186+
set_prop_cycle(label=values[, label2=values2[, ...]])
11811187
11821188
Form 1 simply sets given `Cycler` object.
11831189
1184-
Form 2 creates and sets a `Cycler` from a label and an iterable.
1190+
Form 2 creates and sets a `Cycler` from a label and an iterable.
11851191
1186-
Form 3 composes and sets a `Cycler` as an inner product of the
1192+
Form 3 composes and sets a `Cycler` as an inner product of the
11871193
pairs of keyword arguments. In other words, all of the
11881194
iterables are cycled simultaneously, as if through zip().
11891195
11901196
Parameters
11911197
----------
1192-
arg : Cycler
1193-
Set the given Cycler.
1194-
Can also be `None` to reset to the cycle defined by the
1198+
cycler : Cycler
1199+
Set the given Cycler. *None* resets to the cycle defined by the
11951200
current style.
11961201
11971202
label : str
1198-
The property key. Must be a valid `Artist` property.
1203+
The property key. Must be a valid `.Artist` property.
11991204
For example, 'color' or 'linestyle'. Aliases are allowed,
12001205
such as 'c' for 'color' and 'lw' for 'linewidth'.
12011206
1202-
itr : iterable
1207+
values : iterable
12031208
Finite-length iterable of the property values. These values
12041209
are validated and will raise a ValueError if invalid.
12051210
1211+
Examples
1212+
--------
1213+
Setting the property cycle for a single property:
1214+
1215+
>>> ax.set_prop_cycle(color=['red', 'green', 'blue']) # or
1216+
>>> ax.set_prop_cycle('color', ['red', 'green', 'blue'])
1217+
1218+
Setting the property cycle for simultaneously cycling over multiple
1219+
properties (e.g. red circle, green plus, blue cross):
1220+
1221+
>>> ax.set_prop_cycle(color=['red', 'green', 'blue'],
1222+
... marker=['o', '+', 'x'])
1223+
12061224
See Also
12071225
--------
1208-
:func:`cycler` Convenience function for creating your
1209-
own cyclers.
1226+
:func:`cycler` : Convenience function for creating your own cyclers.
12101227
12111228
"""
12121229
if args and kwargs:

0 commit comments

Comments
 (0)
0