PetscDrawUtilitySetCmap — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscDrawUtilitySetCmap

Populate the RGB entries of a colormap from a named palette, honoring options-database overrides for the colormap name, reversal, and brightness.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscDrawUtilitySetCmap(const char colormap[], int mapsize, unsigned char R[], unsigned char G[], unsigned char B[])

Not Collective

## Input Parameters

- colormap - the name of the colormap (e.g. `"hue"`, `"gray"`, `"jet"`, `"viridis"`), or `NULL`/empty for the default

- mapsize - the number of colormap entries to fill

## Output Parameters

- R - the red channel of length `mapsize`

- G - the green channel of length `mapsize`

- B - the blue channel of length `mapsize`

## Options Database Keys

- -draw_cmap name - select the colormap by name

- -draw_cmap_reverse - reverse the colormap

- -draw_cmap_brighten value - brighten (positive) or darken (negative) the colormap; value must be in `(-1, 1)`

## See Also

`PetscDraw`, `PetscDrawUtilitySetGamma()`

## Level

developer

## Location

src/sys/classes/draw/utils/cmap.c

Index of all Draw routines
Table of Contents for all manual pages
Index of all manual pages