qis.plot_stack

qis.plot_stack(df, use_bar_plot=False, is_yaxis_limit_01=False, add_mean_levels=False, add_cum_levels=False, add_total_line=False, colors=None, step=None, title=None, baseline='zero', ncols=1, legend_loc='upper center', legend_labels=None, legend_stats=LegendStats.NONE, var_format='{:.0%}', fontsize=10, linewidth=1.5, x_rotation=90, reverse_columns=False, x_date_freq='YE', date_format='%b-%y', skip_y_axis=True, bbox_to_anchor=None, xlabel=None, ylabel=None, ax=None, **kwargs)[source]

Plot DataFrame columns as stacked areas or stacked bars.

Total lines and total legend titles sum observed components. An all-missing row has an undefined total, not zero.

Parameters:
  • df (DataFrame) – Numeric values to stack. Nullable floating columns are supported; stacked-area rendering represents their missing values as NumPy nan.

  • use_bar_plot (bool) – Use pandas stacked bars instead of Matplotlib stacked areas.

  • add_mean_levels (bool) – Annotate each column’s mean over its observed values.

  • add_cum_levels (bool) – Annotate cumulative observed-value column means.

  • add_total_line (bool) – Draw the per-row total as a black line.

  • colors (List[str]) – One color per column. The caller-owned list is not modified.

  • is_yaxis_limit_01 (bool)

  • step (str | None)

  • title (str | None)

  • baseline (str)

  • ncols (int)

  • legend_loc (str | None)

  • legend_labels (List[str] | None)

  • legend_stats (LegendStats)

  • var_format (str)

  • fontsize (int)

  • linewidth (float)

  • x_rotation (int)

  • reverse_columns (bool)

  • x_date_freq (str)

  • date_format (str)

  • skip_y_axis (bool)

  • bbox_to_anchor (Tuple[float, float] | None)

  • xlabel (str)

  • ylabel (str)

  • ax (Axes)

Returns:

The created figure, or None when the caller supplies ax.

Return type:

Figure