Q:

How to change the color of values that fall outside the determined breaks of the pheatmap function in R

I have 1 question regarding the pheatmap function in R and would be extremely thanksful if anyone could help me out.
1) When doing pheatmaps, I always set my breaks using the break function. However, if a value fall out of the determined breaks it is automatically represented in white. Does anyone know how to set the values that fall out of my breaks to the same color as my max or min? Here is a code-example using the "ALL" library:
library(pheatmap)
library(RColorBrewer)
library(ALL)

data("ALL")
expressionData = exprs(ALL)

#setting breaks to 0 to 5 then 5.01 to 10
breaks = c(seq(0, 5, length.out = 101),seq(5.01, 10, length.out = 101))
breaks2 <- breaks

#setting colors
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 201)

#running pheatmap with 10 first samples
pheatmap(expressionData[1:10, ], color = my_palette, breaks = breaks2)

image of the pheatmap result
Because some of the value for the sample 1005_at are higher than my highest breakpoint of 10, they end up being white. How I could set that values higher than 10 are the same color as the value of 10 (and the other way around, if there were to be values lower than 0, how to set them to the same color as the value 0)?
Thank you very much!!!

A:

This seems to be a possible solution:
library(pheatmap)
library(RColorBrewer)
library(ALL)

data("ALL")
expressionData = exprs(ALL)

#setting breaks to 0 to 5 then 5.01 to 10
breaks = c(seq(0, 5, length.out = 101),seq(5.01, 10, length.out = 101))
breaks2 <- breaks

#setting colors
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 201)

breaks2[length(breaks)] <- max(max(expressionData),max(breaks))
breaks2[1] <- min(min(expressionData),min(breaks))
#running pheatmap with 10 first samples
pheatmap(expressionData[1:10, ], color = my_palette, breaks = breaks2)

