View source: R/colorAccording2.R
colorAccording2 | R Documentation |
This function helps making color-gradients for plotting a numerical variable. It requires the package 'RColorBrewer' being installed from CRAN. Note : RColorBrewer palettes were not integrated here, since they are not continuous.
colorAccording2(
x,
gradTy = "rainbow",
nStartOmit = NULL,
nEndOmit = NULL,
revCol = FALSE,
alpha = 1,
callFrom = NULL
)
x |
(character) color input |
gradTy |
(character) type of gradeint may be 'rainbow', 'heat.colors', 'terrain.colors', 'topo.colors', 'cm.colors', 'hcl.colors', 'grey.colors', 'gray.colorsW' or 'logGray' |
nStartOmit |
(integer) omit n steps from begining of gradient range |
nEndOmit |
(integer or "sep") omit n steps from end of gradient range, if |
revCol |
(logical) reverse order |
alpha |
(numeric) optional transparency value (1 for no transparency, 0 for complete opaqueness) |
callFrom |
(character) allow easier tracking of message(s) produced |
This function returns a character vector (of same length as x) with color encoding
cut
set.seed(2015); dat1 <- round(runif(15),2)
plot(1:15,dat1,pch=16,cex=2,col=colorAccording2(dat1))
plot(1:15,dat1,pch=16,cex=2,col=colorAccording2(dat1,nStartO=0,nEndO=4,revCol=TRUE))
plot(1:9,pch=3)
points(1:9,1:9,col=transpGraySca(st=0,en=0.8,nSt=9,trans=0.3),cex=42,pch=16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.