david-barnett / microViz

R package for microbiome data visualization and statistics. Uses phyloseq, vegan and the tidyverse. Docker image available.
https://david-barnett.github.io/microViz/
GNU General Public License v3.0
105 stars 11 forks source link

how can i order my samples and show their names? #139

Closed we32i225 closed 9 months ago

we32i225 commented 9 months ago

Hello, i am using the comp_heatmap function and have been able to generate a heat map. However, i would like to show the names of each sample on the column axis and order the columns according to the metadata from the phlyoseq object used to create the heatmap.

the code tried: physeq_no1percent %>% tax_transform("compositional", rank = "genus") %>% comp_heatmap( sample_anno = sampleAnnotation( State1 = anno_sample("sample")))

This displays the correct sample names but they are not ordered in any way, can i re-order the columns as well as add the sample names above each column?

many thanks Will

david-barnett commented 9 months ago

this new example should hopefully help you with the sample ordering (see the section "arranging samples")

https://david-barnett.github.io/microViz/articles/web-only/heatmaps.html#arranging-samples

david-barnett commented 9 months ago

oh and for showing the sample names, add sample_names_show = TRUE to the comp_heatmap call

we32i225 commented 9 months ago

Hi David, just tried this and its exactly what i was looking for ! many thanks Will