- Cycle(*args, N=None, samples=None, name=None, **kwargs)[source]¶
Generate and merge
Cyclerinstances in a variety of ways.
cycle-spec, optional) – Positional arguments control the colors in the
Cyclerobject. If zero arguments are passed, the single color
'black'is used. If more than one argument is passed, the resulting cycles are merged. Arguments are interpreted as follows:
Cycler, nothing more is done.
If a list of RGB tuples or color strings, these colors are used.
DiscreteColormap, colors from the
colorsattribute are used.
If a string cycle name, that
DiscreteColormapis looked up and its
In all other cases, the argument is passed to
Colormap, and colors from the resulting
ContinuousColormapare used. See the
If the last positional argument is numeric, it is used for the
N – Shorthand for
float, optional) – For
DiscreteColormaps, this is the number of colors to select. For example,
Cycle('538', 4)returns the first 4 colors of the
'538'color cycle. For
ContinuousColormaps, this is either a list of sample coordinates used to draw colors from the colormap, or an integer number of colors to draw. If the latter, the sample coordinates are
np.linspace(0, 1, samples). For example,
Cycle('Reds', 5)divides the
'Reds'colormap into five evenly spaced colors.
- Other Parameters
c, color, colors (
color-spec, optional) – A list of colors passed as keyword arguments. This is equivalent to passing a list of colors as the first positional argument and is included for consistency with
lw, ls, d, a, m, ms, mew, mec, mfc – Shorthands for the below keywords.
linewidth, linestyle, dashes, alpha, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor (
specs, optional) – Lists of
Line2Dproperties that can be added to the
Cyclerinstance. If the input was already a
Cycler, these are added or appended to the existing cycle keys. If the lists have unequal length, they are repeated to their least common multiple (note that matplotlib throws an error in this case). For more info on cyclers see
set_prop_cycle. Also see the line style reference, the marker reference, and the custom dashes reference.
linewidths, linestyles, dashes, alphas, markers, markersizes, markeredgewidths, markeredgecolors, markerfacecolors – Aliases for the above keywords.
**kwargs – If the input is not already a
Cyclerinstance, these are passed to
Colormapand used to build the
DiscreteColormapfrom which the cycler will draw its colors.
Cycler– A cycler instance that can be passed to