33_litmus-fitting_functions: Fit Litmus Objects to Data

Description Usage Arguments Details Value References See Also Examples

Description

Functions to fit litmus objects to vectors of data.

Usage

1
2
litmus.fit (x, colvs, ...,
    color.space="sRGB", reverse=FALSE, equalize=0.85, na.color="#FFFFFF")

Arguments

x

A numeric vector.

colvs

A 3-column or 4-column numeric matrix, where each row is one color vector, and the optional fourth column is alpha values.

color.space

A string giving the color space, refer to the details section for litmus objects.

reverse

Logical, reverse the order of the colors.

equalize

Numeric, between zero and one, refer to details.

na.color

A single string representing an R color.

...

Ignored.

Details

Refer to the litmus function for background information.

The litmus.fit function constructs a litmus object.

Given n colors, it computes a length-n vector of knots computed from a vector of data.

If equalize is zero, the knots are equally spaced from the lowest x value to the highest. If equalize is one, then knots are selected, such that there's an approximately equal number of points between each pair of knots. And equalization values between zero and one result in an intermediate effect.

Note that high equalize values (higher than the default) may cause color interpolation to appear less smooth.

In general, it's easiest to wrap the litmus.fit function inside another function.

Value

All functions return litmus objects, except the hot.and.cold function which returns a mlitmus object.

References

Refer to the vignette for an overview, references and better examples.

See Also

Main Plotting Functions

Functional Versions
Which take a function as their main argument.

Global Options

litmus, mlitmus

Predefined Litmus Objects, Predefined Litmus-Fitting Functions
With predefined colors.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
rainbow.litmus.fit.3 <- function (x, ..., reverse=FALSE)
{   colvs <- cbind (c (110, 170, 230, 290), 42.5, 75)
    litmus.fit (x, colvs, color.space="HCL", reverse=reverse)
}

x <- rnorm (30)
colf <- rainbow.litmus.fit.3 (x)

plot (colf)

colf (seq (-1, 1,, 10) )

barsurf documentation built on Jan. 20, 2021, 5:08 p.m.