macrosynergy.visuals.lineplot#

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

class LinePlot(df, cids=None, xcats=None, metrics=None, intersect=False, tickers=None, blacklist=None, start=None, end=None, *args, **kwargs)[source]#

Bases: Plotter

Class for plotting time series data on a line plot. 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_date – ISO-8601 formatted date. Select data from this date onwards. If None, all dates are selected.

  • end_date – ISO-8601 formatted date. Select data up to and including this date. If None, all dates are selected.

plot(metric='value', compare_series=None, figsize=(12, 8), aspect=1.618, height=0.8, grid=True, x_axis_label=None, y_axis_label=None, axis_fontsize=12, ax_hline=None, ax_vline=None, title=None, title_fontsize=16, title_xadjust=0.5, title_yadjust=1.05, legend=True, legend_labels=None, legend_title=None, legend_loc='best', legend_fontsize=14, legend_ncol=1, legend_bbox_to_anchor=None, legend_frame=True, show=True, save_to_file=None, dpi=300, return_figure=False, on_axis=None, *args, **kwargs)[source]#