matplotlib.colors.ColorSequenceRegistry#

classmatplotlib.colors.ColorSequenceRegistry[source]#

Bases:Mapping

Container for sequences of colors that are known to Matplotlib by name.

The universal registry instance ismatplotlib.color_sequences. Thereshould be no need for users to instantiateColorSequenceRegistrythemselves.

Read access uses a dict-like interface mapping names to lists of colors:

importmatplotlibasmplcolors=mpl.color_sequences['tab10']

For a list of built in color sequences, seeNamed color sequences.The returned lists are copies, so that their modification does not changethe global definition of the color sequence.

Additional color sequences can be added viaColorSequenceRegistry.register:

mpl.color_sequences.register('rgb',['r','g','b'])
register(name,color_list)[source]#

Register a new color sequence.

The color sequence registry stores a copy of the givencolor_list, sothat future changes to the original list do not affect the registeredcolor sequence. Think of this as the registry taking a snapshotofcolor_list at registration.

Parameters:
namestr

The name for the color sequence.

color_listlist ofcolor

An iterable returning valid Matplotlib colors when iterating over.Note however that the returned color sequence will always be alist regardless of the input type.

unregister(name)[source]#

Remove a sequence from the registry.

You cannot remove built-in color sequences.

If the name is not registered, returns with no error.

Examples usingmatplotlib.colors.ColorSequenceRegistry#

Named color sequences

Named color sequences

Nested pie charts

Nested pie charts