macrosynergy.panel.view_metrics#
Function for visualising the eop_lag, mop_lag or grading metrics for a given set of cross sections and extended categories.
- view_metrics(df, xcat, cids=None, start=None, end=None, freq='M', agg='mean', metric='eop_lag', title=None, figsize=(14, None))[source]#
A function to visualise the eop_lag, mop_lag or grading metrics for a given JPMaQS dataset. It generates a heatmap, where the x-axis is the observation date, the y-axis is the ticker, and the colour is the lag value.
- Parameters:
df (Dataframe) – standardized DataFrame with the necessary columns: ‘cid’, ‘xcat’, ‘real_date’ and ‘grading’, ‘eop_lag’ or ‘mop_lag’.
xcat (str) – extended category whose lags are to be visualized.
cids (List[str]) – cross sections to visualize. Default is all in DataFrame.
start (str) – earliest date in ISO format. Default is earliest available.
end (str) – latest date in ISO format. Default is latest available.
metric (str) – name of metric to be visualized. Must be “eop_lag” (default) “mop_lag” or “grading”.
freq (str) – frequency of data. Must be one of “D”, “W”, “M”, “Q”, “A”. Default is “M”.
agg (str) – aggregation method. Must be one of “mean” (default), “median”, “min”, “max”, “first” or “last”.
title (str) – string of chart title; if none given default title is printed.
figsize (Tuple[float]) – Tuple (w, h) of width and height of graph. Default is None, meaning it is set in accordance with df.
- Raises:
TypeError – if any of the inputs are of the wrong type.
ValueError – if any of the inputs are semantically incorrect.
- Returns:
None
- Return type:
None