I am trying to create a heat map where the colors of the cells are not relative to the other values in the grid, but are linked to absolute values (a bit like the cell formatting in excel, e.g., green for values between 0.20 and 0.25). I have been playing around with the R package superheat
but it is still unclear to me how to provide such a mapping. Any recommendations on how this can be done? Preferably using superheat but hints on how to do it via other packages are fine as well.
UPDATE: For instance, using the mtcars dataset, we get
superheat(mtcars,
X.text = as.matrix(mtcars),
legend.breaks = c(min(mtcars), 0, max(mtcars)))
Adding a new row to the dataframe, we get different colors for the exact same values in the original rows:
mtcars.new <- rbind(mtcars,
extrarow = c(-100, 6, 20, 10, 6, 2, 10, 1, 1, 6, 6))
superheat(mtcars.new,
X.text = as.matrix(mtcars.new),
legend.breaks = c(min(mtcars.new), 0, max(mtcars.new)))
What I would like to have, is that the colors do not depend on the values present in the dataframe, such that when maps are created for different datasets, they can be directly compared to each other.