macrosynergy.visuals.heatmap#

A subclass inheriting from macrosynergy.visuals.plotter.Plotter, designed to plot time series data as a heatmap.

class Heatmap(df, cids=None, xcats=None, metrics=None, start=None, end=None, *args, **kwargs)[source]#

Bases: Plotter

Class for plotting time series data as a heatmap. Inherits from macrosynergy.visuals.plotter.Plotter.

Parameters :type df: DataFrame :param df: A DataFrame with the following columns:

‘cid’, ‘xcat’, ‘real_date’, and at least one metric from - ‘value’, ‘grading’, ‘eop_lag’, or ‘mop_lag’.

Parameters:
  • cids (Optional[List[str]]) – A list of cids to select from the DataFrame. If None, all cids are selected.

  • xcats (Optional[List[str]]) – A list of xcats to select from the DataFrame. If None, all xcats are selected.

  • metrics (Optional[List[str]]) – A list of metrics to select from the DataFrame. If None, all metrics are selected.

  • start (Optional[str]) – ISO-8601 formatted date. Select data from this date onwards. If None, all dates are selected.

  • end (Optional[str]) – ISO-8601 formatted date. Select data up to and including this date. If None, all dates are selected.

plot_metric(x_axis_column, y_axis_column, metric, xcats=None, cids=None, start=None, end=None, freq=None, agg='mean', figsize=(12, 8), x_axis_label=None, y_axis_label=None, axis_fontsize=14, title=None, title_fontsize=22, title_xadjust=0.5, title_yadjust=1.0, vmin=None, vmax=None, show=True, save_to_file=None, dpi=300, return_figure=False, on_axis=None, max_xticks=50, cmap=None, rotate_xticks=0, rotate_yticks=0, show_tick_lines=True, show_colorbar=True, show_annotations=False, show_boundaries=False, annotation_fontsize=14, tick_fontsize=13, *args, **kwargs)[source]#