togray: Convert continuous variable to grey levels

Description Usage Arguments Value Author(s) Examples

Description

Convert a continuous variable to the corresponding levels of grey.

Usage

1
2
3
4
5
togray(x, min = 0.1, max = 0.9, alpha = NULL, inverse = FALSE,
  sqrt = FALSE)

togrey(x, min = 0.1, max = 0.9, alpha = NULL, inverse = FALSE,
  sqrt = FALSE)

Arguments

x

A numeric vector.

min

The minimum grey level.

max

The maximum grey level.

alpha

The opacity.

inverse

Logical. By default, bigger is darker. If inverse = TRUE, bigger is lighter.

sqrt

Logical. Applies a square root transformation to get more progressive grey levels.

Value

A vector of colors of the same length as x.

Author(s)

From Clement Calenge, modified by Mathieu Basille basille@ufl.edu

Examples

1
2
3
4
bla <- runif(10000)
plot(bla, col = togray(bla, 0, 1), pch = 20)
plot(bla, col = togray(bla, 0, 1, sqrt = TRUE), pch = 20)
plot(bla, col = togray(bla, 0, 1, alpha = 0.5), pch = 20)

basille/basr documentation built on May 11, 2019, 8:32 p.m.