0

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.

Vishwas
  • 343
  • 2
  • 13
Zhen
  • 1
  • 1
    Welcome to SO. Could you share your data or make a minimal reproducible example so we can run your code? – Jaccar Sep 18 '19 at 16:04
  • Does the matrix contain any `Inf` or `NaN` values? Have you checked there are no character class variables in the matrix? – Joe Sep 27 '19 at 14:45

0 Answers0