p.colorbypositive: Color by positive or negative

Description Usage Arguments Value Examples

View source: R/colorbypositive.R

Description

p.colorbypositive is a function to create a vector with colors by positive or negative. Recommended to color graphics created with metools p.functions.

Usage

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

Arguments

x

a numeric vector

colorp

Positive values color (default=Green)

colorn

Negative values color (default=Red)

Value

Return a vector with colors.

Examples

1
2
3
4
v=c(-3,-2,2,-2,3,2)
p.colorbypositive(x=v,colorp="blue",colorn="grey")

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

jvg0mes/metools documentation built on June 28, 2020, 2:38 a.m.