Ordering heatmap columns #116
-
Is there a way to order heatmap columns by the sample name, rather than by a distance method? This is my current code, from a phyloseq object called hm_T3_11 htmp_T3_11 <- hm_T3_11 %>% |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, you can set the sample_seriation argument to the "Identity" method, which keeps the samples in the original order. You can sort the samples beforehand using ps_arrange and whichever variable(s) in the sample data you like, e.g. data("dietswap", package = "microbiome")
dietswap %>%
ps_filter(timepoint == 2) %>%
tax_agg("Genus") %>%
tax_sort(by = sum) %>%
ps_arrange(nationality, sample) %>%
comp_heatmap(taxa = 1:20, sample_seriation = "Identity", sample_names_show = TRUE) |
Beta Was this translation helpful? Give feedback.
Yes, you can set the sample_seriation argument to the "Identity" method, which keeps the samples in the original order.
You can sort the samples beforehand using ps_arrange and whichever variable(s) in the sample data you like, e.g.