Plot Config#

Biotuner Plotting Configuration#

Module type: Functions

This module provides consistent color schemes, styles, and configuration for all biotuner visualizations.

Author: Biotuner Team

set_biotuner_style(style: str = 'whitegrid')[source]#

Apply consistent biotuner plotting style globally.

Parameters:

style (str, default=’whitegrid’) – Seaborn style to use as base. Options: ‘whitegrid’, ‘darkgrid’, ‘white’, ‘dark’, ‘ticks’

Examples

>>> from biotuner.plot_config import set_biotuner_style
>>> set_biotuner_style()
reset_style()[source]#

Reset matplotlib to default style.

get_color_palette(name: str = 'biotuner_gradient', n_colors: int | None = None)[source]#

Get a color palette for plotting.

Parameters:
  • name (str, default=’biotuner_gradient’) – Name of the palette. Options: ‘viridis’, ‘plasma’, ‘coolwarm’, ‘spectral’, ‘biotuner_gradient’

  • n_colors (int, optional) – Number of colors to return. If None, returns full palette.

Returns:

palette (list) – List of color codes

Examples

>>> colors = get_color_palette('biotuner_gradient', n_colors=5)
get_emd_colors(n_imfs: int = 5)[source]#

Get colors for EMD/IMF plotting.

Parameters:

n_imfs (int, default=5) – Number of IMFs to generate colors for

Returns:

colors (list) – List of color codes for each IMF

Examples

>>> colors = get_emd_colors(n_imfs=5)
get_band_colors(bands: list | None = None)[source]#

Get colors for frequency bands.

Parameters:

bands (list, optional) – List of band names. If None, uses standard EEG bands.

Returns:

colors (list or dict) – Colors for each band

Examples

>>> colors = get_band_colors(['delta', 'theta', 'alpha'])
get_plot_config(plot_type: str) Dict[str, Any][source]#

Get configuration dictionary for a specific plot type.

Parameters:

plot_type (str) – Type of plot: ‘psd’, ‘emd’, ‘harmonic’, ‘entropy’, ‘dissonance’, ‘rhythm’

Returns:

config (dict) – Configuration parameters for the plot

Examples

>>> config = get_plot_config('psd')
>>> fig, ax = plt.subplots(figsize=config['figsize'])
update_plot_config(plot_type: str, **kwargs) Dict[str, Any][source]#

Get plot configuration and update with custom parameters.

Parameters:
  • plot_type (str) – Type of plot

  • **kwargs – Custom parameters to override defaults

Returns:

config (dict) – Updated configuration

Examples

>>> config = update_plot_config('psd', figsize=(12, 8), title='My Custom Title')
class biotuner_style(style: str = 'whitegrid')[source]#

Bases: object

Context manager for temporarily applying biotuner style.

Examples

>>> with biotuner_style():
...     plt.plot([1, 2, 3], [1, 4, 9])
...     plt.show()