I am new to R and started using pheatmap to visualize log2 fold changes in gene expression in treated vs control cells. By default, pheatmap sets the upper limit of the color key to 6 and the lower limit to -2. Is there a way to assign the colors in a way that all values above 4 are assigned to the maximum intensity of red, values below -1 are assigned to the maximum intensity of blue and values in between are assigned to colors of varying intensity?
This is the code I have been using:
pheatmap(my_matrix,cluster_cols = FALSE,cellwidth = 30,fontsize = 7,height = 40,show_rownames = FALSE)
I would like to use as colors:
colorRampPalette(rev(brewer.pal(n=7,name="RdYlBu")))