powered by
p.colorbyvar is a function to create a vector with colors by variation. Recommended to color graphics created with metools p.functions.
p.colorbyvar(x, colorp = "#17B221", colorn = "#B21717", lag = 1)
a numeric vector
Positive changes color (default=Green)
Negative changes color (default=Red)
Lag to comparison (default=1)
Return a vector with colors.
# NOT RUN { v=c(3,2,5,6,5,4) p.colorbyvar(x=v,colorp="blue",colorn="grey") barplot(v,col=p.colorbyvar(v)) # }
Run the code above in your browser using DataLab