uvisbox.Core.CommonInterface.boxplot_style_config

Unified styling configuration for boxplot visualizations.

Module Contents

class uvisbox.Core.CommonInterface.boxplot_style_config.BoxplotStyleConfig[source]

Configuration for median and outlier visualization in statistical boxplots.

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

Variables:
  • percentiles (list of float) – Percentiles for the bands to be plotted (default: [25, 50, 75, 90]).

  • percentile_colormap (str 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_bands (bool) – Whether to display the percentile bands (default: True).

  • show_median (bool) – Whether to display the median curve/contour (default: True).

  • median_color (str) – Color for the median curve/contour (default: ‘red’).

  • median_width (float) – Line width for the median curve/contour (default: 3.0).

  • median_alpha (float) – Transparency level for the median, 0.0 to 1.0 (default: 1.0).

  • show_outliers (bool) – Whether to display outlier curves/contours (default: False).

  • outliers_color (str) – Color for outlier curves/contours (default: ‘gray’).

  • outliers_width (float) – Line width for outlier curves/contours (default: 1.0).

  • outliers_alpha (float) – 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
... )
percentiles: list = [25, 50, 75, 90]
percentile_colormap: str = 'viridis'
show_bands: bool = True
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
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

Return type:

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