pyvista.CompositePolyDataMapper.set_unique_colors#
- CompositePolyDataMapper.set_unique_colors(color_cycler: bool = True)[source]#
Set each block of the dataset to a unique color.
This uses
matplotlib
’s color cycler by default.When a custom color cycler, or a sequence of color-like objects, is passed it sets the blocks to the corresponding colors.
- Parameters:
Examples
Set each block of the composite dataset to a unique color.
>>> import pyvista as pv >>> dataset = pv.MultiBlock( ... [pv.Cube(), pv.Sphere(center=(0, 0, 1))] ... ) >>> pl = pv.Plotter() >>> actor, mapper = pl.add_composite(dataset) >>> mapper.set_unique_colors() >>> mapper.block_attr[1].color Color(name='tab:orange', hex='#ff7f0eff', opacity=255) >>> mapper.block_attr[2].color Color(name='tab:green', hex='#2ca02cff', opacity=255)