pyvista.plotting.themes.Theme.color_cycler#

property Theme.color_cycler[source]#

Return or set the default color cycler used to color meshes.

This color cycler is iterated over by each renderer to sequentially color datasets when displaying them through add_mesh.

When setting, the value must be either a list of color-like objects, or a cycler of color-like objects. If the value passed is a single string, it must be one of:

  • 'default' - Use the default color cycler (matches matplotlib’s default)

  • 'matplotlib - Dynamically get matplotlib’s current theme’s color cycler.

  • 'all' - Cycle through all of the available colors in pyvista.plotting.colors.hexcolors

Setting to None will disable the use of the color cycler.

Examples

Set the default color cycler to iterate through red, green, and blue.

>>> import pyvista as pv
>>> pv.global_theme.color_cycler = ['red', 'green', 'blue']
>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(pv.Cone(center=(0, 0, 0)))  # red
>>> _ = pl.add_mesh(pv.Cube(center=(1, 0, 0)))  # green
>>> _ = pl.add_mesh(pv.Sphere(center=(1, 1, 0)))  # blue
>>> _ = pl.add_mesh(pv.Cylinder(center=(0, 1, 0)))  # red again
>>> pl.show()  
../../../_images/pyvista-plotting-themes-Theme-color_cycler-1_00_00.png