macrosynergy.visuals.timelines#
Function for visualising a facet grid of time line charts of one or more categories ```python import macrosynergy.visuals as msv … msv.view.timelines(
df, xcats=[“FXXR”, “EQXR”, “IR”], cids=[“USD”, “EUR”, “GBP”]
)#
- timelines(df, xcats=None, cids=None, intersect=False, val='value', cumsum=False, start='2000-01-01', end=None, ncol=3, square_grid=False, legend_ncol=1, same_y=True, all_xticks=False, xcat_grid=False, xcat_labels=None, single_chart=False, label_adj=0.05, title=None, title_adj=0.95, title_xadj=0.5, title_fontsize=22, cs_mean=False, size=(12, 7), aspect=1.7, height=3.0, legend_fontsize=12)[source]#
Displays a facet grid of time line charts of one or more categories.
Parameters :type df:
DataFrame
:param df: standardized DataFrame with the necessary columns:‘cid’, ‘xcat’, ‘real_date’ and at least one column with values of interest.
- Parameters:
xcats (
Optional
[List
[str
]]) – extended categories to plot. Default is all in DataFrame.cids (
Optional
[List
[str
]]) – cross sections to plot. Default is all in DataFrame. If this contains only one cross section a single line chart is created.intersect (
bool
) – if True only retains cids that are available for all xcats. Default is False.val (
str
) – name of column that contains the values of interest. Default is ‘value’.cumsum (
bool
) – plot cumulative sum of the values over time. Default is False.start (
str
) – earliest date in ISO format. Default is earliest date available.end (
Optional
[str
]) – latest date in ISO format. Default is latest date available.ncol (
int
) – number of columns in facet grid. Default is 3.legend_ncol (
int
) – number of columns in legend. Default is 1.same_y (
bool
) – if True (default) all plots in facet grid share same y axis.all_xticks (
bool
) – if True x-axis tick labels are added to all plots in grid. Default is False, i.e only the lowest row displays the labels.xcat_grid (
bool
) – if True, shows a facet grid of line charts for each xcat for a single cross section. Default is False, only one cross section is allowed with this option.xcat_labels (
Optional
[List
[str
]]) – labels to be used for xcats. If not defined, the labels will be identical to extended categories.single_chart (
bool
) – if True, all lines are plotted in a single chart.title_adj (
float
) – parameter that sets top of figure to accommodate title. Default is 0.95.title_xadj (
float
) – parameter that sets x position of title. Default is 0.5.title_fontsize (
int
) – font size of title. Default is 16.label_adj (
float
) – parameter that sets bottom of figure to fit the label. Default is 0.05.cs_mean (
bool
) – if True this adds a line of cross-sectional averages to the line charts. This is only allowed for function calls with a single category. Default is False.size (
Tuple
[Number
,Number
]) – two-element tuple setting width/height of single cross section plot. Default is (12, 7). This is irrelevant for facet grid.aspect (
Number
) – width-height ratio for plots in facet. Default is 1.7.height (
Number
) – height of plots in facet. Default is 3.legend_fontsize (
int
) – font size of legend. Default is 12.