diff options
| author | Chris Sobczak <chris@sobczak.family> | 2026-07-06 14:34:31 -0700 |
|---|---|---|
| committer | Chris Sobczak <chris@sobczak.family> | 2026-07-06 14:34:31 -0700 |
| commit | e6f6a49b41a26b184cbdc7b3f532f3deef01031d (patch) | |
| tree | 7b7d8cad34549a6ab8ac2fd1e9a5d287ee958c32 /R | |
| parent | d26e218f30cc80235c170f85e368f7c361ebf1e4 (diff) | |
Fix factors
Diffstat (limited to 'R')
| -rw-r--r-- | R/heatmap.R | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/R/heatmap.R b/R/heatmap.R index 77721ce..c40946f 100644 --- a/R/heatmap.R +++ b/R/heatmap.R @@ -75,6 +75,8 @@ heatmap <- function(R, title = NULL, labels = FALSE){ rownames(M) <- R_list$rnames df <- reshape2::melt(M, na.rm = TRUE) colnames(df) <- c('i', 'j', 'value') + df$i <- as.numeric(df$i) + df$j <- as.numeric(df$j) # And plot it p <- ggplot2::ggplot( @@ -82,6 +84,8 @@ heatmap <- function(R, title = NULL, labels = FALSE){ ggplot2::aes(x = .data$j, y = .data$i, fill = .data$value) ) + ggplot2::geom_tile() + + ggplot2::scale_y_reverse() + + ggplot2::coord_fixed(clip = 'off') + ggplot2::scale_fill_gradient2( low = 'red', mid = 'white', @@ -91,8 +95,6 @@ heatmap <- function(R, title = NULL, labels = FALSE){ name = NULL, guide = 'none' ) + - ggplot2::scale_y_reverse() + - ggplot2::coord_fixed(clip = 'off') + ggplot2::theme_void() if(!is.null(title)){ @@ -112,7 +114,7 @@ heatmap <- function(R, title = NULL, labels = FALSE){ row_label_df <- data.frame( j = seq_len(n)[-n], i = seq_len(n)[-n], - label = R_list$cnames[-n] + label = R_list$rnames[-n] ) max_nchar <- max(nchar(R_list$cnames)) |
