calour.amplicon_experiment.AmpliconExperiment.plot_stacked_bar

AmpliconExperiment.plot_stacked_bar(field=None, sample_color_bars=None, color_bar_label=True, barx_label_kwargs=None, barx_width=0.3, barx_colors=None, title=None, figsize=(12, 8), legend_size='small', xtick=False, cmap='Paired')[source]

Plot the stacked bar for feature abundances.

Parameters:
  • field (str, or None) – a column name in feature metadata. the values in the column will be used as the legend labels
  • sample_color_bars (list, optional) – list of column names in the sample metadata. It plots a color bar for each unique column to indicate sample group. It doesn’t plot color bars by default (None)
  • color_bar_label (bool) – whether to show the label on the color bars
  • barx_label_kwargs (dict, optional) – keyword arguments to pass in for matplotlib.axes.Axes.annotate() for labels on the X-axis bar
  • barx_width (float, optional) – the width of the color bar
  • barx_colors (dict, optional) – the colors for each unique value in the values list. if it is None, it will use Dark2 discrete color map in a cycling way.
  • title (str) – figure title
  • figsize (tuple of numeric) – figure size passed to figsize in plt.figure
  • legend_size (str or int) – passed to fontsize in ax.legend()
  • xtick (str, False, or None) – how to draw ticks and tick labels on x axis. str: use a column name in sample metadata; None: use sample IDs; False: do not draw ticks.
  • cmap (string) – matplotlib qualitative colormap
Returns:

The Figure object containing the plot.

Return type:

matplotlib.figure.Figure