get_element_colors: Get colors for a named vector based on a color palette.

View source: R/colors.R

get_element_colorsR Documentation

Get colors for a named vector based on a color palette.

Description

Get colors for a named vector based on a color ramp palette.

Usage

get_element_colors(v, colRamp, rearr = F)

Arguments

v

character vector. Unique elements to get colors for.

colRamp

colorRampPalette functions object containing colors for palette. Use function get_col_palette() to create. See ?colorRampPalette .

rearr

logical; should vector be arranged so a color gradient isn't created with the original vector order?

Details

x <- LETTERS1:6 get_element_colors(x, get_col_palette("RdBu")) get_element_colors(x, colorRampPalette(RColorBrewer::brewer.pal(9, "RdBu")))

Value

A character vector of colors with the same length as v. The names of this vector are the unique elements specified by v.


kazeera/hourglass documentation built on April 5, 2025, 7:18 a.m.