From 2a78288451b39b0a22a702fb4adebcc8ddee7e75 Mon Sep 17 00:00:00 2001 From: Marcel Costa Date: Sat, 5 Feb 2022 07:54:08 +0100 Subject: [PATCH] Cambiar la forma de ordenar los ejes. --- R/ggheatmap.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/ggheatmap.R b/R/ggheatmap.R index f67f440..a084013 100644 --- a/R/ggheatmap.R +++ b/R/ggheatmap.R @@ -14,10 +14,11 @@ ggheatmap<-function(df, x=NULL, y=NULL, value=NULL, grouping="mean"){ order<-clustsort(df %>% spread(VarY,Value) %>% as.data.frame) + df$VarX<-factor(df$VarX, levels=order$x) + df$VarY<-factor(df$VarY, levels=order$y) + df %>% ggplot(aes(VarX, VarY, fill=Value))+ - scale_x_discrete(limits=order$x)+ - scale_y_discrete(limits=order$y)+ labs(x=x, y=y)+ theme_heatmap() }