Legend too long for Genus-level bar plots in QIIME2 (does not fit in Word/manuscript)

I am working on a 16S metagenomic dataset generated from Oxford Nanopore sequencing.

For the preprocessing and taxonomic assignment steps, I used the NaMeco (Nanopore Metagenomic Community) pipeline. NaMeco performed , quality filtering, and taxonomic classification of my read sequences.

After obtaining the feature table and taxonomy assignments from NaMeco, I imported these results into QIIME2 to run the downstream diversity analyses and visualizations. For the compositional analysis, I generated stacked bar plots using the standard command:

qiime taxa barplot

My issue arises when I visualize my results at taxonomic level 6 (Genus) for my manuscript. The legend generated by QIIME2 is far too long to fit properly within the width of a standard Word document or manuscript column.

The problem is that QIIME2 displays the full taxonomic hierarchy for each genus in the legend, rather than just the short genus name. For example, I get:

d__Bacteria;p__Firmicutes;c__Clostridia;o__Oscillospirales;f__Ruminococcaceae;g__Faecalibacterium

instead of simply:

Faecalibacterium

This makes the figure completely unreadable and impossible to integrate into a publication-ready manuscript.

My questions are:

Is there a native QIIME2 option (either via the command line or within the .qzv visualization interface) to automatically shorten the taxonomic labels in the legend? For example, can I configure QIIME2 to display only the genus epithet (e.g., only g__Faecalibacterium or even just Faecalibacterium) instead of the entire d__p__c__o__f__g__ path?

If this is not possible directly within QIIME2, what is the most straightforward and robust method to export my QIIME2 feature table and taxonomy into R (using phyloseq and ggplot2) to generate a clean, publication-quality bar plot? Ideally, I would like to display only the top 10–12 most abundant genera, group all the remaining genera into an "Other" category, and show only the short genus names in the legend.

I am currently using QIIME2 version 2025.7 If anyone has experience dealing with this specific issue (especially after using NaMeco) or has a recommended workflow (or R script) to clean up these figures, I would be very grateful for your advice!

Thank you in advance for your help.

Hello!

Thank you for using NaMeco!

It is not related to the preprocessing step, it is just how the plugin works.

  • My favorite way of doing it is by exporting CSV files from barplots and plotting them in Python. I have no proper experience with R, but there is a qiime2R GitHub repo. But anyway, with csv files from the barplot.qza file, or by using taxa counts at the desired level that were produced by NaMeco directly, you can use any R tutorial for making nice figures.

  • You can also do it in Qiime2:

  1. NaMeco produces 2 taxonomy files: one in Q2 format (all taxonomy ranks in one string), and a second with taxonomy ranks separated by columns. Open both files, copy the column in the second file that contains taxonomy rank of your interest, and use it to replace the "Taxon" column content in the first table.
  2. Save the first table into a new TSV file, and import it again to Qiime2.
  3. Recreate the barplot within Qiime2 and select "level 0" (should be the only one available). Labels now should be short, showing only the desired level.
  4. When you open the barplot in the browser, in the legend, you can click on the color square (left of the taxonomy label). You will notice that only this taxon is plotted now.
  5. Select the top 10-15 taxa and download SVG for bars and legend.
  6. Cut the legend later as needed to show top 10-15 taxa only.

As an alternative, you can use "rescript edit-taxonomy" to modify the taxonomy file you already have (thank you @Nicholas_Bokulich)

Hope it helps.

2 Likes