p.colorbypositive {metools} | R Documentation |
Color by positive or negative
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
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
v=c(-3,-2,2,-2,3,2)
p.colorbypositive(x=v,colorp="blue",colorn="grey")
barplot(v,col=p.colorbypositive(v))
[Package metools version 1.0.0 Index]