Description Usage Arguments Value Examples
View source: R/colorbypositive.R
p.colorbypositive is a function to create a vector with colors by positive or negative. Recommended to color graphics created with metools p.functions.
1 | p.colorbypositive(x, colorp = "#17B221", colorn = "#B21717")
|
x |
a numeric vector |
colorp |
Positive values color (default=Green) |
colorn |
Negative values color (default=Red) |
Return a vector with colors.
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.