Skip to contents

Preview one or multiple colors using little rhombi with their little labels up top

Usage

previewcolor(
  x,
  main = NULL,
  bg = "#333333",
  main_col = "#b3b3b3",
  main_x = 0.7,
  main_y = 0.2,
  main_adj = 0,
  main_cex = 0.9,
  main_font = 2,
  width = NULL,
  xlim = NULL,
  ylim = c(0, 2.2),
  asp = 1,
  labels_y = 1.55,
  label_cex = NULL,
  mar = c(0, 0, 0, 1),
  par_reset = TRUE,
  filename = NULL,
  pdf_width = 8,
  pdf_height = 2.5
)

Arguments

x

Color, vector: One or more colors that R understands

main

Character: Title. Default = NULL, which results in deparse(substitute(x))

bg

Background color.

main_col

Color: Title color

main_x

Float: x coordinate for main.

main_y

Float: y coordinate for main.

main_adj

Float: adj argument to mtext for main.

main_cex

Float: character expansion factor for main.

main_font

Integer, 1 or 2: Weight of main 1: regular, 2: bold.

width

Float: Plot width. Default = NULL, i.e. set automatically

xlim

Vector, length 2: x-axis limits. Default = NULL, i.e. set automatically

ylim

Vector, length 2: y-axis limits.

asp

Float: Plot aspect ratio.

labels_y

Float: y coord for labels. Default = 1.55 (rhombi are fixed and range y .5 - 1.5)

label_cex

Float: Character expansion for labels. Default = NULL, and is calculated automatically based on length of x

mar

Numeric vector, length 4: margin size.

par_reset

Logical: If TRUE, reset par settings on exit.

filename

Character: Path to save plot as PDF.

pdf_width

Numeric: Width of PDF in inches.

pdf_height

Numeric: Height of PDF in inches.

Value

Nothing, prints plot.

Author

EDG

Examples

if (FALSE) { # \dontrun{
colors <- colorgradient.x(seq(-5, 5))
previewcolor(colors)
} # }