I would like to mix different color setting in my pheatmap depending on the value. For example I would like a range of color blue -> white -> green for value comprise between -2 and 2 and a specific value let's say "red", "pink", "purple" for value equal to 10, 20 and 30
I tried like this but this is not working
library(colorRamp2)
data= data.frame(A1=rnorm(40), A2=rnorm(40), A3=rnorm(40), A4=sample(c(10,20,30), 40, replace = TRUE))
my_palette= c(colorRamp2(c(-2,2), c("white", "green")),
colorRamp2(c(10, 20, 30), c("red", "pink", "blue")))
pheatmap(data, color=my_palette)
Any ideas to mix different colors setting