- 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 sequence 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
floator sequence of
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 sequence 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 (sequence of
color-spec, optional) – A sequence of colors passed as keyword arguments. This is equivalent to passing a sequence of colors as the first positional argument and is included for consistency with
set_prop_cycle. If positional arguments were passed, the colors in this list are appended to the colors resulting from the positional arguments.
lw, ls, d, a, m, ms, mew, mec, mfc – Shorthands for the below keywords.
linewidth, linestyle, dashes, alpha, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor (
objector sequence of
object, 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