-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rcolor.R
51 lines (43 loc) · 1.19 KB
/
Rcolor.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
redscale<-function(n=24){
rgb((1:n) - 1, 0, 0, maxColorValue=n)
}
blueyellow<-function(n=24){
color=colorRampPalette(c("blue", "yellow"))(n)
return(color)
}
whitered<-function(n=24){
color=colorRampPalette(c("white", "red"))(n)
return(color)
}
whiteyellow<-function(n=24){
color=colorRampPalette(c("white", "yellow"))(n)
return(color)
}
whiteblue<-function(n=24){
color=colorRampPalette(c("white", "blue"))(n)
return(color)
}
whitebrown<-function(n=24){
color=colorRampPalette(c("white", "brown"))(n)
return(color)
}
whiteblack<-function(n=24){
color=colorRampPalette(c("white", "black"))(n)
return(color)
}
yellowblue<-function(n=24){
color=colorRampPalette(c("yellow", "blue"))(n)
return(color)
}
jetColors<-function(N=24){
k <- ceiling(N/4)
temp.red <- c(rep(0, 2 * k), 1:k, rep(k, k - 1), k:1)
temp.green <- c(rep(0, k), 1:k, rep(k, k - 1), k:1, rep(0,k))
temp.blue <- c(1:k, rep(k, k - 1), k:1, rep(0, 2 * k))
temp.rgb <- cbind(temp.red, temp.green, temp.blue)
delta <- 5 * k - 1 - N
delta <- ceiling(delta/2)
temp.rgb <- temp.rgb[delta:(delta + N - 1), ]/k
color<-rgb(temp.rgb[, 1], temp.rgb[, 2], temp.rgb[, 3])
return(color)
}