Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liao961120 committed Jul 24, 2024
1 parent 82360f9 commit 91a7b48
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@ vals2cols = function(x, center=0) {
max_scale = max(abs(x))
x = x / max_scale
}
p.pal = colorRamp(c("lightgoldenrod1", "orange", "orangered", "red"))
n.pal = colorRamp(c("lightgoldenrod1", "yellowgreen", "green", "blue"))
p.pal = colorRamp(c("#865C6A", "#ED553B", "red"))
n.pal = colorRamp(c("#865C6A", "#20639B", "blue"))
sapply(x, \(v) {
if (v > 0)
return(rgb(p.pal(v), max=255))
else
return(rgb(n.pal(-v), max=255))
})
}
# x = rnorm(1e3)
# plot(seq(x), x, col= vals2cols(x), pch=19)

0 comments on commit 91a7b48

Please # to comment.