enter image description hereI am very new to R and I am trying to make a pheatmap out of my data. I just copied some existing code included in a tutorial and it seems it pretty nicely fitted to my data after some tweaking. I also included some quantile code, that should change the color breaks based on the data I have, because most of the values are between 0-100 but just couple of them is in thousands. I would like to make it so the small values are more variable in colours and keep the light yellow only to the most extreme values. From the legend it seems it is the other way around right now... Can somebody help me to tweak the breaks? Thanks! Here is my code and the output heatmap (changed because it contained sensitive data..).
x <- read.table("proteins_cpm_commas.tsv", header=TRUE, row.names = 1)
x <- as.matrix(x)
x
pheatmap(x,
drop_levels = TRUE,
cluster_rows=F,
cluster_cols=F,
treeheight_col = 0,
treeheight_row = 0,
fontsize = 8,
color = inferno(length(mat_breaks) - 1),
breaks = mat_breaks,
main = "Title ")
mat_breaks <- seq(min(x), max(x), length.out = 20)
mat_breaks
quantile_breaks <- function(xs, n = 20) {
breaks <- quantile(xs, probs = seq(0, 1, length.out = n))
breaks[!duplicated(breaks)]
}
mat_breaks <- quantile_breaks(x, n = 20)
mat_breaks