AAMutPlot.aa_comparison
- AAMutPlot.aa_comparison(df_impact, from_aa, to_aa, top_n=20, ax=None, figsize=(6, 5))[source]
Plot the per-scale signed delta for one amino acid substitution pair.
Bars are colored by sign (increase vs decrease) so the physicochemical direction of a single
from_aa->to_aasubstitution is visible across the most-affected scales.- Parameters:
df_impact (pd.DataFrame) – Substitution-impact table produced by
AAMut.run().from_aa (str) – Substituted-from amino acid (single letter).
to_aa (str) – Substituted-to amino acid (single letter).
top_n (int, default=20) – Number of scales with the largest absolute delta to show.
ax (Axes, optional) – Pre-defined Axes object to plot on. If
None, a new one is created.figsize (tuple, default=(6, 5)) – Figure dimensions (width, height) in inches (used when
axisNone).
- Returns:
fig (Figure) – Figure object containing the plot.
ax (Axes) – Axes object of the amino acid comparison plot.
Notes
Returned as a
(fig, ax)pair (seeAAMutPlotfor the shared return contract).
Examples
:meth:
AAMutPlot.aa_comparisonshows the signed per-scale delta of a single substitution pair (red = increase, blue = decrease).import matplotlib.pyplot as plt import aaanalysis as aa aa.plot_settings() df_impact = aa.AAMut().run(from_aa="M", to_aa="V") aa.AAMutPlot().aa_comparison(df_impact=df_impact, from_aa="M", to_aa="V", top_n=10) plt.tight_layout() plt.show()