uvisbox.Modules.FunctionalBoxplot.functional_boxplot_vis

Module Contents

uvisbox.Modules.FunctionalBoxplot.functional_boxplot_vis.plot_band(bottom_curve, top_curve, vmin=0, vmax=1, ax=None, color='red', alpha=1.0, scale=1.0)[source]

Plot a functional band envelope between bottom and top curves.

This function creates a filled area between the curves using matplotlib’s fill_between.

Parameters:
  • bottom_curve (np.ndarray) – 1D array representing the bottom boundary of the band.

  • top_curve (np.ndarray) – 1D array representing the top boundary of the band.

  • ax (matplotlib.axes.Axes, optional) – Matplotlib axes to plot on. If None, creates new figure with axes.

  • color (str or tuple, optional) – Color for the band. Default is ‘red’. Can be any matplotlib color specification (named color, hex, RGB tuple, etc.).

  • alpha (float, optional) – Transparency of the band (0=transparent, 1=opaque). Default is 1.0.

  • scale (float, optional) – Scale factor for the curves. Default is 1.0.

Returns:

ax – The matplotlib axes object used for plotting.

Return type:

matplotlib.axes.Axes

Raises:

ValueError – If bottom_curve and top_curve have different shapes.

Examples

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from uvisbox.Modules.FunctionalBoxplot import plot_band
>>> from uvisbox.Modules.FunctionalBoxplot.functional_boxplot_stats import functional_boxplot_get_band
>>>
>>> # Generate synthetic data
>>> data = np.random.randn(100, 50).cumsum(axis=1)
>>>
>>> # Get 50th percentile band
>>> bottom, top = functional_boxplot_get_band(data, 50, method='fbd')
>>>
>>> # Plot the band
>>> fig, ax = plt.subplots()
>>> plot_band(bottom, top, ax=ax, color='blue', alpha=0.5)
>>> plt.show()
uvisbox.Modules.FunctionalBoxplot.functional_boxplot_vis.visualize_functional_boxplot(mesh_data, vmin=0, vmax=1, boxplot_style=None, ax=None)[source]

Visualize functional boxplot from mesh data (summary statistics).

This function creates a matplotlib visualization of the functional boxplot using the summary statistics output from the stats/mesh pipeline.

Parameters:
  • mesh_data (dict) – Dictionary containing summary statistics with the following keys: - ‘percentile_bands’: dict of percentile bands - ‘median’: median curve - ‘outliers’: outlier curves - ‘sorted_curves’: all curves sorted by depth

  • boxplot_style (BoxplotStyleConfig, optional) – Configuration for the boxplot visualization including percentiles, colormap, and median/outlier styling. If None, uses default configuration.

  • ax (matplotlib.axes.Axes, optional) – Matplotlib axes to plot on. If None, creates a new figure.

Returns:

ax – The matplotlib axes object with the plot.

Return type:

matplotlib.axes.Axes

Examples

>>> import numpy as np
>>> from uvisbox.Modules.FunctionalBoxplot.functional_boxplot_stats import functional_boxplot_summary_statistics
>>> from uvisbox.Modules.FunctionalBoxplot.functional_boxplot_mesh import functional_boxplot_mesh
>>> from uvisbox.Modules.FunctionalBoxplot.functional_boxplot_vis import visualize_functional_boxplot
>>> from uvisbox.Core.CommonInterface import BoxplotStyleConfig
>>>
>>> # Generate synthetic functional data
>>> t = np.linspace(0, 1, 100)
>>> data = np.array([np.sin(2*np.pi*t) + 0.2*np.random.randn(100) for _ in range(50)])
>>>
>>> # Process through pipeline
>>> stats = functional_boxplot_summary_statistics(data)
>>> mesh_data = functional_boxplot_mesh(stats)
>>>
>>> # Visualize
>>> ax = visualize_functional_boxplot(mesh_data)
>>>
>>> # Custom styling
>>> style = BoxplotStyleConfig(percentiles=[25, 50, 75, 90], show_outliers=True)
>>> ax = visualize_functional_boxplot(mesh_data, boxplot_style=style)