Core.CommonInterface package

Submodules

Core.CommonInterface.boxplot_style_config module

Unified styling configuration for boxplot visualizations.

class Core.CommonInterface.boxplot_style_config.BoxplotStyleConfig(percentiles: list = <factory>, percentile_colormap: str = 'viridis', show_median: bool = True, median_color: str = 'red', median_width: float = 3.0, median_alpha: float = 1.0, show_outliers: bool = False, outliers_color: str = 'gray', outliers_width: float = 1.0, outliers_alpha: float = 0.5)[source]

Bases: object

Configuration for median and outlier visualization in statistical boxplots.

This configuration is shared across CurveBoxplot, ContourBoxplot, and FunctionalBoxplot modules to ensure consistent styling.

Attributes:

percentileslist of float

Percentiles for the bands to be plotted (default: [25, 50, 75, 90]).

percentile_colormapstr or matplotlib.colors.Colormap

Colormap for percentile band colors. Can be a colormap name (e.g., ‘viridis’) or a matplotlib Colormap object. Percentiles are mapped to [0, 1] range (percentile/100) to sample colors from the colormap (default: ‘viridis’).

show_medianbool

Whether to display the median curve/contour (default: True).

median_colorstr

Color for the median curve/contour (default: ‘red’).

median_widthfloat

Line width for the median curve/contour (default: 3.0).

median_alphafloat

Transparency level for the median, 0.0 to 1.0 (default: 1.0).

show_outliersbool

Whether to display outlier curves/contours (default: False).

outliers_colorstr

Color for outlier curves/contours (default: ‘gray’).

outliers_widthfloat

Line width for outlier curves/contours (default: 1.0).

outliers_alphafloat

Transparency level for outliers, 0.0 to 1.0 (default: 0.5).

Examples:

>>> # Use defaults (viridis colormap)
>>> config = BoxplotStyleConfig()
>>> # Use different colormap
>>> config = BoxplotStyleConfig(percentile_colormap='plasma')
>>> # Use custom matplotlib colormap
>>> import matplotlib.pyplot as plt
>>> from matplotlib.colors import LinearSegmentedColormap
>>> custom_cmap = LinearSegmentedColormap.from_list('custom', ['lightblue', 'darkblue'])
>>> config = BoxplotStyleConfig(percentile_colormap=custom_cmap)
>>> # Customize median only
>>> config = BoxplotStyleConfig(median_color='blue', median_width=5)
>>> # Hide median, show custom outliers with hot colormap
>>> config = BoxplotStyleConfig(
...     percentile_colormap='hot',
...     show_median=False,
...     show_outliers=True,
...     outliers_color='orange',
...     outliers_alpha=0.8
... )
>>> # Completely custom
>>> config = BoxplotStyleConfig(
...     percentiles=[25, 50, 75, 95],
...     percentile_colormap='coolwarm',
...     show_median=True,
...     median_color='darkblue',
...     median_width=4,
...     median_alpha=0.9,
...     show_outliers=True,
...     outliers_color='purple',
...     outliers_width=2,
...     outliers_alpha=0.6
... )
__init__(percentiles: list = <factory>, percentile_colormap: str = 'viridis', show_median: bool = True, median_color: str = 'red', median_width: float = 3.0, median_alpha: float = 1.0, show_outliers: bool = False, outliers_color: str = 'gray', outliers_width: float = 1.0, outliers_alpha: float = 0.5) None
get_percentile_colors()[source]

Get colors for percentile bands by sampling from the colormap.

Percentiles are mapped to [0, 1] range using percentile/100, then colors are sampled from the colormap at those positions.

Returns:

list : List of RGBA tuples (one per percentile)

Examples:

>>> config = BoxplotStyleConfig(percentiles=[0, 50, 100])
>>> colors = config.get_percentile_colors()
>>> # Returns colors from start, middle, and end of viridis colormap
median_alpha: float = 1.0
median_color: str = 'red'
median_width: float = 3.0
outliers_alpha: float = 0.5
outliers_color: str = 'gray'
outliers_width: float = 1.0
percentile_colormap: str = 'viridis'
percentiles: list
show_median: bool = True
show_outliers: bool = False

Module contents

Common interfaces and configurations shared across UVisBox modules.

class Core.CommonInterface.BoxplotStyleConfig(percentiles: list = <factory>, percentile_colormap: str = 'viridis', show_median: bool = True, median_color: str = 'red', median_width: float = 3.0, median_alpha: float = 1.0, show_outliers: bool = False, outliers_color: str = 'gray', outliers_width: float = 1.0, outliers_alpha: float = 0.5)[source]

Bases: object

Configuration for median and outlier visualization in statistical boxplots.

This configuration is shared across CurveBoxplot, ContourBoxplot, and FunctionalBoxplot modules to ensure consistent styling.

Attributes:

percentileslist of float

Percentiles for the bands to be plotted (default: [25, 50, 75, 90]).

percentile_colormapstr or matplotlib.colors.Colormap

Colormap for percentile band colors. Can be a colormap name (e.g., ‘viridis’) or a matplotlib Colormap object. Percentiles are mapped to [0, 1] range (percentile/100) to sample colors from the colormap (default: ‘viridis’).

show_medianbool

Whether to display the median curve/contour (default: True).

median_colorstr

Color for the median curve/contour (default: ‘red’).

median_widthfloat

Line width for the median curve/contour (default: 3.0).

median_alphafloat

Transparency level for the median, 0.0 to 1.0 (default: 1.0).

show_outliersbool

Whether to display outlier curves/contours (default: False).

outliers_colorstr

Color for outlier curves/contours (default: ‘gray’).

outliers_widthfloat

Line width for outlier curves/contours (default: 1.0).

outliers_alphafloat

Transparency level for outliers, 0.0 to 1.0 (default: 0.5).

Examples:

>>> # Use defaults (viridis colormap)
>>> config = BoxplotStyleConfig()
>>> # Use different colormap
>>> config = BoxplotStyleConfig(percentile_colormap='plasma')
>>> # Use custom matplotlib colormap
>>> import matplotlib.pyplot as plt
>>> from matplotlib.colors import LinearSegmentedColormap
>>> custom_cmap = LinearSegmentedColormap.from_list('custom', ['lightblue', 'darkblue'])
>>> config = BoxplotStyleConfig(percentile_colormap=custom_cmap)
>>> # Customize median only
>>> config = BoxplotStyleConfig(median_color='blue', median_width=5)
>>> # Hide median, show custom outliers with hot colormap
>>> config = BoxplotStyleConfig(
...     percentile_colormap='hot',
...     show_median=False,
...     show_outliers=True,
...     outliers_color='orange',
...     outliers_alpha=0.8
... )
>>> # Completely custom
>>> config = BoxplotStyleConfig(
...     percentiles=[25, 50, 75, 95],
...     percentile_colormap='coolwarm',
...     show_median=True,
...     median_color='darkblue',
...     median_width=4,
...     median_alpha=0.9,
...     show_outliers=True,
...     outliers_color='purple',
...     outliers_width=2,
...     outliers_alpha=0.6
... )
__init__(percentiles: list = <factory>, percentile_colormap: str = 'viridis', show_median: bool = True, median_color: str = 'red', median_width: float = 3.0, median_alpha: float = 1.0, show_outliers: bool = False, outliers_color: str = 'gray', outliers_width: float = 1.0, outliers_alpha: float = 0.5) None
get_percentile_colors()[source]

Get colors for percentile bands by sampling from the colormap.

Percentiles are mapped to [0, 1] range using percentile/100, then colors are sampled from the colormap at those positions.

Returns:

list : List of RGBA tuples (one per percentile)

Examples:

>>> config = BoxplotStyleConfig(percentiles=[0, 50, 100])
>>> colors = config.get_percentile_colors()
>>> # Returns colors from start, middle, and end of viridis colormap
median_alpha: float = 1.0
median_color: str = 'red'
median_width: float = 3.0
outliers_alpha: float = 0.5
outliers_color: str = 'gray'
outliers_width: float = 1.0
percentile_colormap: str = 'viridis'
percentiles: list
show_median: bool = True
show_outliers: bool = False