Learn R Programming

barsurf (version 0.5.0)

09_multi-litmus_objects: Multi-Litmus Objects

Description

Color functions that combine multiple litmus objects.

Usage

mlitmus (…, default.color="#D0D0D0", na.color=default.color)

hot.and.cold (a=-1, b=1, xb=0)

Arguments

One or more litmus objects.

default.color

String, color that is returned for x values outside the litmus objects' knots.

na.color

String, color that is returned for NA x values.

a

Numeric, the lower limit (first knot).

b

Numeric, the upper limit (last knot).

xb

Numeric, giving the breakpoint between "hot" and cold".

Value

An mlitmus object.

Details

This function creates a color function similar to a litmus object, containing one or more litmus objects. (Noting that these functions return mlitmus objects, so you call these functions, and then if necessary you can evaluate the resulting function).

The color function works out which litmus object to use for each input value.

An example is using one set of colors for positive values and another set of colors for negative values.

Note that it's possible for litmus objects to overlap. This may be changed, so this feature should not be used inside packages.

References

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

See Also

litmus

Examples

Run this code
# NOT RUN {
colf <- mlitmus (blue.litmus (-1, 0, reverse=TRUE), green.litmus (0, 1) )

#evaluate
colf (c (-1, 0, 1) )
# }

Run the code above in your browser using DataLab