diff options
Diffstat (limited to 'R/corplot.R')
| -rw-r--r-- | R/corplot.R | 10 |
1 files changed, 4 insertions, 6 deletions
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() |
