portfolio_optimization.components.visualization module

This module contains visualization tools.

portfolio_optimization.components.visualization.plot_front(diversification_values, roc_values, color=None, label=None, c=None, vmin=None, vmax=None, alpha=None, cmap=None, ax=None)[source]

Plots a pareto front of the given data-points in a Diversification-ROC plot.

Parameters:
  • diversification_values (ArrayLike) – 1-D ArrayLike containing the x values of the plot.

  • roc_values (ArrayLike) – 1-D ArrayLike containing the y values of the plot.

  • color (Optional[str]) – Optional color to use for the points. For an overview of allowed colors see the Matplotlib Documentation. If None is given, a default color will be assigned by matplotlib. Default is None.

  • label (Optional[str]) – Label to use in the legend. If None is given, no label will be used. Default is None.

  • c (Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]], Sequence[Union[tuple[float, float, float], str, tuple[float, float, float, float], tuple[Union[tuple[float, float, float], str], float], tuple[tuple[float, float, float, float], float]]], tuple[float, float, float], tuple[float, float, float, float], tuple[Union[tuple[float, float, float], str], float], tuple[tuple[float, float, float, float], float], None]) – The marker colors as used by matplotlib.

  • vmin (Optional[float]) – min value of data range that colormap covers as used by matplotlib.

  • vmax (Optional[float]) – max value of data range that colormap covers as used by matplotlib.

  • alpha (Optional[float]) – The alpha blending value as used by matplotlib.

  • cmap (UnionType[str, Colormap, None]) – The Colormap instance or registered colormap name as used by matplotlib.

  • ax (Optional[Axes]) – Axes to plot on. If None, a new figure with one Axes will be created.

Return type:

PatchCollection

Returns:

The matplotlib PathCollection object created by scatter.

portfolio_optimization.components.visualization.plot_points(diversification_values, roc_values, color=None, label=None, c=None, vmin=None, vmax=None, alpha=None, cmap=None, ax=None)[source]

Plots the given data-points in a Diversification-ROC plot.

Parameters:
  • diversification_values (ArrayLike) – 1-D ArrayLike containing the x values of the plot.

  • roc_values (ArrayLike) – 1-D ArrayLike containing the y values of the plot.

  • color (Optional[str]) – Optional color to use for the points. For an overview of allowed colors see the Matplotlib Documentation. If None is given, a default color will be assigned by matplotlib. Default is None.

  • label (Optional[str]) – Label to use in the legend. If None is given, no label will be used. Default is None.

  • c (Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]], Sequence[Union[tuple[float, float, float], str, tuple[float, float, float, float], tuple[Union[tuple[float, float, float], str], float], tuple[tuple[float, float, float, float], float]]], tuple[float, float, float], tuple[float, float, float, float], tuple[Union[tuple[float, float, float], str], float], tuple[tuple[float, float, float, float], float], None]) – The marker colors as used by matplotlib.

  • vmin (Optional[float]) – min value of data range that colormap covers as used by matplotlib.

  • vmax (Optional[float]) – max value of data range that colormap covers as used by matplotlib.

  • alpha (Optional[float]) – The alpha blending value as used by matplotlib.

  • cmap (UnionType[str, Colormap, None]) – The Colormap instance or registered colormap name as used by matplotlib.

  • ax (Optional[Axes]) – Axes to plot on. If None, a new figure with one Axes will be created.

Return type:

PatchCollection | Any

Returns:

The matplotlib PathCollection object created by scatter.