Composable cycles¶
| Version: | 0.10.0 |
|---|---|
| Date: | February 16, 2016 |
| docs | http://matplotlib.org/cycler |
| pypi | https://pypi.python.org/pypi/Cycler |
| github | https://github.com/matplotlib/cycler |
cycler API¶
cycler(*args, **kwargs) |
Create a new Cycler object from a single positional argument, a pair of positional arguments, or the combination of keyword arguments. |
Cycler(left[, right, op]) |
Composable cycles |
concat(left, right) |
Concatenate two cyclers. |
The public API of cycler consists of a class Cycler, a
factory function cycler(), and a concatenation function
concat(). The factory function provides a simple interface for
creating ‘base’ Cycler objects while the class takes care of the
composition and iteration logic.
Cycler Usage¶
Base¶
A single entry Cycler object can be used to easily
cycle over a single style. To create the Cycler use the cycler()
function to link a key/style/kwarg to series of values. The key must be
hashable (as it will eventually be used as the key in a dict).
In [1]: from __future__ import print_function
In [2]: from cycler import cycler
In [3]: color_cycle = cycler(color=['r', 'g', 'b'])
In [4]: color_cycle
Out[4]: cycler('color', ['r', 'g', 'b'])
The Cycler knows it’s length and keys:
In [5]: len(color_cycle)
Out[5]: 3
In [6]: color_cycle.keys