Zhen
Zhen

Reputation: 1

Heatmap with NA values

I was trying to plot a heatmap however in my matrix i have a bunch of NAs. I don't want to throw away the whole rows so i am looking for a solution here. The first error is NA/NaN/Inf in foreign function call (arg 11). I am thinking the hcluster is not working with Na data. How about add some breaks and label NAs to black color. I tried the code

my_palette <- colorRampPalette(c("yellow", "orange", "red")) (n=20)
breaks <- seq(min(treatment.matrix, na.rm = T), max(treatment.matrix, na.rm = T), length.out=21)
heatmap.2(treatment.matrix, trace="none", na.color = "black", scale="none", col = my_palette, breaks=breaks)

But the same error happened. Please help. Thank you.

Upvotes: 0

Views: 635

Answers (0)

Related Questions