Browse code

use non-zero values

jokergoo authored on 13/03/2019 08:52:38
Showing1 changed files

... ...
@@ -72,7 +72,7 @@ default_col = function(x, main_matrix = FALSE) {
72 72
         return(colors)
73 73
     } else if(is.numeric(x)) {
74 74
         if(main_matrix) {
75
-            p = sum(x > 0)/length(x)
75
+            p = sum(x > 0)/sum(x != 0)
76 76
             if(p > 0.3 & p < 0.7) {
77 77
                 if(ht_opt$verbose) {
78 78
                     cat("This matrix has both negative and positive values, use a color mapping symmetric to zero\n")