macrosynergy.visuals.table#
- view_table(df, title=None, title_fontsize=16, figsize=(14, 4), min_color=-1, max_color=1, xlabel=None, ylabel=None, xticklabels=None, yticklabels=None, annot=True, fmt='.2f', return_fig=False, highlight_mask=None, footnote=None, footnote_fontsize=10)[source]#
Display a numeric DataFrame as an annotated colour-coded heatmap table.
- Parameters:
df (pd.DataFrame) – Numeric DataFrame to display.
title (str, optional) – Title displayed above the heatmap.
title_fontsize (int, optional) – Font size of the title. Default is 16.
figsize (Tuple[float, float], optional) – Width and height of the figure in inches.
min_color (float) – Data value mapped to the bottom of the colormap. Default is -1.
max_color (float) – Data value mapped to the top of the colormap. Default is 1.
xlabel (str, optional) – Label for the x-axis.
ylabel (str, optional) – Label for the y-axis.
xticklabels (List[str], optional) – Tick labels for the columns. Defaults to the DataFrame column names.
yticklabels (List[str], optional) – list of strings to label y-axis ticks. Default is None.
annot (bool or array-like of str) – if a bool, controls whether the numeric values of
dfare annotated. If a DataFrame or 2D array of strings is supplied, those strings are rendered as cell annotations verbatim (fmtis ignored).fmt (str) – string format for annotations. Default is ‘.2f’. Ignored when
annotis array-like.return_fig (bool) – If True, return the Matplotlib figure object instead of displaying.
highlight_mask (array-like of bool, optional) – DataFrame or 2D array of the same shape as
df. Cells where the mask is True have their annotation text rendered in black and bold. Has no effect whenannotis False.footnote (str, optional) – Free-text caption rendered below the heatmap, useful for noting the statistical test, the panel scope, or how to read the annotations. Multi-line strings are supported. Default is None (no footnote).
footnote_fontsize (int, optional) – Font size for the footnote text. Default is 10.
- Return type: