qis.plot_time_series

qis.plot_time_series(df, linestyles=None, linewidth=1.0, x_date_freq='YE', date_format='%d-%b-%y', legend_title=None, legend_loc='upper left', trend_line=TrendLine.NONE, trend_line_colors=None, legend_stats=LegendStats.AVG_LAST, desc_table_type=DescTableType.NONE, legend_labels=None, xlabel=None, ylabel=None, var_format='{:,.2f}', markers=False, title=None, fontsize=10, markersize=None, colors=None, x_limits=None, y_limits=None, is_log=False, ax=None, **kwargs)[source]

plot columns of a DataFrame against its index, with summary statistics in the legend.

The general time-series plot the rest of the package builds on. Its distinguishing argument is legend_stats: the legend carries statistics computed on the plotted window, so the numbers beside a series always describe the data actually drawn.

Pass preserve_gaps=True in kwargs to draw missing observations as line breaks.

Arguments shared with every plot_* function — ax, title, var_format, x_date_freq, fontsize, colors, xlabel, ylabel, legend_loc, markersize, y_limits — are documented in qis/docs/plotting_kwargs.md.

Parameters:
  • df (Series | DataFrame) – values indexed by date, one line per column. A Series is plotted as one line

  • linestyles (List[str]) – matplotlib line styles, one per column

  • linewidth (float) – line width in points

  • x_date_freq (str | None) – tick frequency on the date axis

  • date_format (str) – strftime format for the tick labels

  • legend_title (str) – heading above the legend entries

  • trend_line (TrendLine | None) – trend line drawn through each series

  • trend_line_colors (List[str]) – colours for those trend lines, defaulting to the series colours

  • legend_stats (LegendStats) – which statistics each legend entry reports; see LegendStats

  • desc_table_type (DescTableType) – descriptive statistics table drawn beside the plot. Observed infinity is rejected before drawing when this table is displayed; when var_format is None, table values use native scalar text

  • legend_labels (List[str]) – replace the column names in the legend. Statistics from legend_stats are appended to these

  • markers (List[str]) – marker style per column, or False for lines only

  • is_log (bool) – log scale on the vertical axis

  • x_limits (Tuple[float | None, float | None]) – (low, high) on the date axis, either end may be None

  • legend_loc (str | bool | None)

  • xlabel (str)

  • ylabel (str)

  • var_format (str | None)

  • title (str | bool)

  • fontsize (int)

  • markersize (int)

  • colors (List[str])

  • y_limits (Tuple[float | None, float | None])

  • ax (Axes)

Returns:

the figure drawn on, or None when ax was supplied or df is empty

Raises:

ValueError – If a descriptive table is displayed and df contains infinity.

Return type:

Figure | None