You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug when input.colours = TRUE and there are missing values (NA) in the input x, then the colours will not display correctly in the heatmap.
It seems one of the desired input colours is completely replaced with darkgray (the default missing value colour):
Solution
One can simply replace the NAs with a desired color beforehand (e.g. darkgray). Alternatively, we could make this change directly within create.heatmap where if any missing values are detected, they are replaced with fill.colour.
Example
suppressPackageStartupMessages(library(BoutrosLab.plotting.general));
n<-10;
heat.data<-data.frame(rep('blue', n), rep('yellow', n), rep('red', n));
heat.data[1,1] <-NA;
# Notice yellow doesnt show up
create.heatmap(
x=heat.data,
input.colours=TRUE,
clustering.method='none',
main='Yellow does not show up'
);
# once you replace NA's with a color, then the yellows will show upind.miss<- which(is.na(heat.data), arr.ind=TRUE);
heat.data[ind.miss] <-'darkgray';
create.heatmap(
x=heat.data,
input.colours=TRUE,
clustering.method='none',
main='Now yellow correctly shows'
)
There is a bug when
input.colours = TRUE
and there are missing values (NA
) in the inputx
, then the colours will not display correctly in the heatmap.It seems one of the desired input colours is completely replaced with
darkgray
(the default missing value colour):Solution
One can simply replace the
NA
s with a desired color beforehand (e.g.darkgray
). Alternatively, we could make this change directly withincreate.heatmap
where if any missing values are detected, they are replaced withfill.colour
.Example
Created on 2024-05-22 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: