p.colorbyvar {metools}R Documentation

Color by variation

Description

p.colorbyvar is a function to create a vector with colors by variation. Recommended to color graphics created with metools p.functions.

Usage

p.colorbyvar(x, colorp = "#17B221", colorn = "#B21717", lag = 1)

Arguments

x

a numeric vector

colorp

Positive changes color (default=Green)

colorn

Negative changes color (default=Red)

lag

Lag to comparison (default=1)

Value

Return a vector with colors.

Examples

v=c(3,2,5,6,5,4)
p.colorbyvar(x=v,colorp="blue",colorn="grey")

barplot(v,col=p.colorbyvar(v))


[Package metools version 1.0.0 Index]