macrosynergy.visuals.view_availability#

view_availability(df, title='Variable Availability', n_ticks=10, fig_kw=None, heatmap_kw=None, xticklabel_kw=None, yticklabel_kw=None, title_kw=None, return_fig=False)[source]#

Plot a binary availability heatmap from a Quantamental DataFrame.

Tickers (one per cid/xcat pair) are ordered descending by last available date, then by total count of available observations, then alphabetically.

Parameters:
  • df (pd.DataFrame) – Standardised QuantamentalDataFrame with columns “real_date”, “cid”, “xcat”, and “value”. The “value” column must contain only binary (0/1) entries indicating availability.

  • title (str) – Title displayed above the heatmap. Default is “Variable Availability”.

  • n_ticks (int) – Number of date labels shown on the x-axis. Default is 10.

  • fig_kw (dict, optional) – Keyword arguments forwarded to “plt.subplots”, for example “figsize”.

  • heatmap_kw (dict, optional) – Keyword arguments forwarded to “sns.heatmap”, for example “cmap” or “linewidths”.

  • xticklabel_kw (dict, optional) – Keyword arguments forwarded to “ax.set_xticklabels”, for example “rotation”, “fontsize”, or “ha”.

  • yticklabel_kw (dict, optional) – Keyword arguments forwarded to “ax.set_yticklabels”, for example “rotation” or “fontsize”.

  • title_kw (dict, optional) – Keyword arguments forwarded to “ax.set_title”, for example “fontsize”, “pad”, or “loc”.

  • return_fig (bool) – If True, return the Matplotlib figure instead of displaying it.

Returns:

The figure object when “return_fig” is True, otherwise None.

Return type:

plt.Figure or None