col_to_hex: Convert Colors to Hex Codes

View source: R/S04_Plotting.R

col_to_hexR Documentation

Convert Colors to Hex Codes

Description

Convert a color name to a hex color code.

Usage

col_to_hex(col, alpha = 1)

Arguments

col

A character string corresponding to a supported color name (e.g., 'blue', 'darkred', etc.). See colors.

alpha

Degree of transparency from 0 (transparent) to 1 (opaque).

Examples

# Create scatter plot for bivariate normal
plot_blank(c(-4, 4), c(-4, 4))
# Draw semi-opaque blue points
points(rnorm(1000), rnorm(1000),
  pch = 19,
  col = col_to_hex("blue", alpha = .3)
)

rettopnivek/arfpam documentation built on Oct. 20, 2024, 7:24 p.m.