From e7fb3801a7bfc507fb6eb86101741d9d41fd8fd0 Mon Sep 17 00:00:00 2001 From: Chris Sobczak Date: Thu, 11 Jun 2026 23:38:07 -0700 Subject: Fix it so that it displays upper right --- R/corplot.R | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'R') diff --git a/R/corplot.R b/R/corplot.R index 5f8f97d..4a9335e 100644 --- a/R/corplot.R +++ b/R/corplot.R @@ -47,13 +47,11 @@ corplot <- function(R, title = NULL){ M[upper.tri(M)] <- R df <- reshape2::melt(M, na.rm = TRUE) colnames(df) <- c('i', 'j', 'value') - df$i <- factor(df$i, levels = 1:n) - df$j <- factor(df$j, levels = 1:n) # And plot it p <- ggplot2::ggplot( data = df, - ggplot2::aes(x = i, y = j, fill = value) + ggplot2::aes(x = j, y = i, fill = value) ) + ggplot2::geom_tile() + ggplot2::scale_fill_gradient2( @@ -62,10 +60,10 @@ corplot <- function(R, title = NULL){ high = 'blue', midpoint = 0, limits = c(-1, 1), - name = NULL + name = NULL, + guide = 'none' ) + - ggplot2::scale_x_discrete(limits = levels(df$i)) + - ggplot2::scale_y_discrete(limits = rev(levels(df$j))) + + ggplot2::scale_y_reverse() + ggplot2::coord_fixed() + ggplot2::theme_void() -- cgit v1.2.3