qis.df_boxplot_by_hue_var

qis.df_boxplot_by_hue_var(df, hue_var_name='date', x_index_var_name=None, y_var_name='returns', is_heatmap_colors=True, hue_order=None, title=None, colors=None, ax=None, **kwargs)[source]

box plots of a wide DataFrame melted into long form, one box per hue value.

The frame is melted so that the index becomes one variable and the columns another, and the boxes then show the distribution across whichever of the two is not on the axis. The usual use is a panel of asset returns melted by date, giving one box per period across assets — the cross-sectional dispersion over time.

Arguments shared with every plot_* function are documented in qis/docs/plotting_kwargs.md.

Parameters:
  • df (Series | DataFrame) – wide frame, typically dates by instruments

  • hue_var_name (str) – name of the melted variable that separates the boxes

  • x_index_var_name (str) – name given to the index once melted. None uses the index name

  • y_var_name (str) – name given to the values once melted, used as the axis label

  • is_heatmap_colors (bool) – colour the boxes along a sequential map in hue order, so that a time-ordered hue reads as a gradient rather than as unrelated categories

  • hue_order (List[str]) – explicit order of the hue values

  • title (str)

  • colors (List[str])

  • ax (Axes)

Returns:

the figure drawn on, or None when ax was supplied

Return type:

Figure | None