AAMutPlot.substitution_matrix

AAMutPlot.substitution_matrix(df_impact, ax=None, figsize=(7, 6), cmap='viridis')[source]

Plot the 20x20 amino acid substitution-impact matrix.

Each cell is the mean absolute substitution delta over scales for a from_aa -> to_aa pair (the overall physicochemical magnitude of that substitution).

Parameters:
  • df_impact (pd.DataFrame) – Substitution-impact table produced by AAMut.run().

  • ax (Axes, optional) – Pre-defined Axes object to plot on. If None, a new one is created.

  • figsize (tuple, default=(7, 6)) – Figure dimensions (width, height) in inches (used when ax is None).

  • cmap (str, default='viridis') – Matplotlib colormap name for the heatmap.

Returns:

  • fig (Figure) – Figure object containing the plot.

  • ax (Axes) – Axes object of the substitution matrix.

Notes

  • Returned as a (fig, ax) pair (see AAMutPlot for the shared return contract).

Examples

:meth:AAMutPlot.substitution_matrix shows the 20x20 mean-absolute substitution impact as a heatmap.

import matplotlib.pyplot as plt
import aaanalysis as aa
aa.plot_settings()
df_impact = aa.AAMut().run()
aa.AAMutPlot().substitution_matrix(df_impact=df_impact)
plt.tight_layout()
plt.show()
../_images/aamut_plot_substitution_matrix_1_output_1_0.png