Reppo for internal functions.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
394 B

  1. ggheatmap<-function(df, x=NULL, y=NULL, value=NULL){
  2. if (is.null(x)){x=colnames(df)[1]}
  3. if (is.null(y)){y=colnames(df)[2]}
  4. if (is.null(value)){value=colnames(df)[3]}
  5. order<-clustsort(df %>% spread(y,value))
  6. df %>%
  7. ggplot(aes(df[,x], df[,y], fill=df[,value]))+
  8. scale_x_discrete(limits=order$x)+
  9. scale_y_discrete(limits=order$y)+
  10. labs(x=x, y=y)+
  11. theme_heatmap()
  12. }