Cycle
- class Cycle(*args, N=None, samples=None, name=None, **kwargs)[source]
Bases:
CyclerGenerate and merge
Cyclerinstances in a variety of ways. The new generated class can be used to internally map keywords to the properties of theCyclerinstance. It is used by various plot functions to cycle through colors, linestyles, markers, etc.- Parameters:
*args (
colormap-specorcycle-spec, optional) – Positional arguments control the colors in theCyclerobject. 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:If a
Cycler, nothing more is done.If a sequence of RGB tuples or color strings, these colors are used.
If a
DiscreteColormap, colors from thecolors
attribute are used. * If a string cycle name, that
DiscreteColormapis looked up and itscolorsare used. * In all other cases, the argument is passed toColormap, and colors from the resultingContinuousColormapare used. See thesamplesargument.If the last positional argument is numeric, it is used for the
sampleskeyword argument.N – Shorthand for
samples.samples (
floator sequence offloat, optional) – ForDiscreteColormaps, this is the number of colors to select. For example,Cycle('538', 4)returns the first 4 colors of the'538'color cycle. ForContinuousColormaps, 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 arenp.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 withset_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 ofobject, optional) – Lists ofLine2Dproperties that can be added to theCyclerinstance. If the input was already aCycler, these are added or appended to the existing cycle keys. If the lists have unequal length, they are repeated to their least common multiple (unlikecycler, which throws an error in this case). For more info on cyclers seeset_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 toColormapand used to build theDiscreteColormapfrom which the cycler will draw its colors.
See also
cycler.cycler,cycler.Cycler,matplotlib.axes.Axes.set_prop_cycle,ultraplot.constructor.Colormap,ultraplot.constructor.Norm,ultraplot.utils.get_colorsSemi-private init.
Do not use this directly, use
cyclerfunction instead.Methods Summary
get_next()Methods Documentation