Display taxa bar plots by group instead of sample-id

Hi @kripow,

Welcome to the forum! I'm not part of the official QIIME 2 team, but I thought I'd chime in. If the kind of barplots you are looking for is similar to below

and if you are a Python user, you may want to check out the Dokdo package I wrote, especially the taxa_abundance_bar_plot method:

qzv_file = 'data/moving-pictures-tutorial/taxa-bar-plots.qzv'

fig, [ax1, ax2, ax3, ax4, ax5] = plt.subplots(1, 5, figsize=(16, 7), gridspec_kw={'width_ratios': [2, 2, 2, 2, 1]})

kwargs = dict(level=6, count=8, sort_by_mean2=False)

api.taxa_abundance_bar_plot(qzv_file,
                            ax=ax1,
                            include_samples={'body-site': ['gut']},
                            **kwargs,
                            artist_kwargs=dict(title='gut'))

api.taxa_abundance_bar_plot(qzv_file,
                            ax=ax2,
                            include_samples={'body-site': ['left palm']},
                            **kwargs,
                            artist_kwargs=dict(title='left palm',
                                               hide_ylabel=True,
                                               hide_yticks=True))

api.taxa_abundance_bar_plot(qzv_file,
                            ax=ax3,
                            include_samples={'body-site': ['right palm']},
                            **kwargs,
                            artist_kwargs=dict(title='right palm',
                                               hide_ylabel=True,
                                               hide_yticks=True))

api.taxa_abundance_bar_plot(qzv_file,
                            ax=ax4,
                            include_samples={'body-site': ['tongue']},
                            **kwargs,
                            artist_kwargs=dict(title='tongue',
                                               hide_ylabel=True,
                                               hide_yticks=True))

api.taxa_abundance_bar_plot(qzv_file,
                            ax=ax5,
                            **kwargs,
                            artist_kwargs=dict(legend_only=True,
                                               legend_loc='upper left',
                                               legend_short=True))

plt.tight_layout()
plt.savefig('images/Dokdo-API/taxa_abundance_bar_plot-9-20210109.png')

You can see the entire Dokdo API here: GitHub - sbslee/dokdo: A Python package for microbiome sequencing analysis with QIIME 2.

Let me know if you have any questions. Good luck!

4 Likes