pyvista.CompositePolyDataMapper.set_scalars#
- CompositePolyDataMapper.set_scalars(
- scalars_name,
- preference,
- component,
- annotations,
- rgb,
- scalar_bar_args,
- n_colors,
- nan_color,
- above_color,
- below_color,
- clim,
- cmap,
- flip_scalars,
- log_scale,
Set the scalars of the mapper.
- Parameters:
- scalars_name
str Name of the scalars in the dataset. Must already exist in at least of the blocks.
- preference
str For each block, when
block.n_points == block.n_cellsand setting scalars, this parameter sets how the scalars will be mapped to the mesh. Default'point', causes the scalars will be associated with the mesh points. Can be either'point'or'cell'.- component
int Set component of vector valued scalars to plot. Must be nonnegative, if supplied. If
None, the magnitude of the vector is plotted.- annotations
dict Pass a dictionary of annotations. Keys are the float values in the scalars range to annotate on the scalar bar and the values are the string annotations.
- rgbbool
If the
scalars_namecorresponds to a 2 dimensional array, plot those values as RGB(A) colors.- scalar_bar_args
dict Dictionary of keyword arguments to pass when adding the scalar bar to the scene. For options, see
pyvista.Plotter.add_scalar_bar().- n_colors
int Number of colors to use when displaying scalars.
- nan_color
ColorLike The color to use for all
NaNvalues in the plotted scalar array.- above_color
ColorLike Solid color for values below the scalars range (
clim). This will automatically set the scalar barabove_labelto'above'.- below_color
ColorLike Solid color for values below the scalars range (
clim). This will automatically set the scalar barbelow_labelto'below'.- clim
Sequence Color bar range for scalars. Defaults to minimum and maximum of scalars array. Example:
[-1, 2].rngis also an accepted alias for this.- cmap
str|list|pyvista.LookupTable Name of the Matplotlib colormap to use when mapping the
scalars. See available Matplotlib colormaps. Only applicable for when displayingscalars.colormapis also an accepted alias for this. Ifcolorcetorcmoceanare installed, their colormaps can be specified by name.You can also specify a list of colors to override an existing colormap with a custom one. For example, to create a three color colormap you might specify
['green', 'red', 'blue'].This parameter also accepts a
pyvista.LookupTable. If this is set, all parameters controlling the color map liken_colorswill be ignored. are installed, their colormaps can be specified by name.- flip_scalarsbool
Flip direction of cmap. Most colormaps allow
*_rsuffix to do this as well.- log_scalebool
Use log scale when mapping data to colors. Scalars less than zero are mapped to the smallest representable positive float.
- scalars_name
- Returns:
dictDictionary of scalar bar arguments.