Examples
Overview
Practical examples demonstrating MD Utils’ most powerful features for interactive visualization and statistical analysis.
⭐ Featured Examples
HTML Grid Dashboards
Create multi-figure HTML dashboards with grid and tabbed layouts. Perfect for comprehensive analysis reports and sharing interactive visualizations.
Key functions: create_plotly_grid_html, create_tabbed_plotly_grid_html
Advanced Statistical Testing
Add statistical significance indicators and model fits to plots: - Cluster-based permutation tests for time series - Automatic box plot significance indicators - Regression fits with confidence intervals
Key functions: add_cluster_permut_sig_to_plotly, add_box_significance_indicator, add_statsmodel_fit
Multi-line Plots & Metadata
Create publication-ready multi-line plots with: - Individual traces + mean ± CI/SD - Automatic significance testing - Metadata annotations for reproducibility
Key functions: multiline_plot, add_meta_info
MNE Plotting
Interactive EEG/MEG visualization with topographic maps and evoked responses: - Spatial distribution visualization with smooth interpolation - Event-related potential plots with confidence intervals - Time-locked topoplots showing activity at specific time points - Automatic channel positioning from MNE info - Customizable colorscales and styling
Key functions: plot_evoked, create_plotly_topoplot
MNE to DataFrame Conversion
Convert MNE Raw and Epochs objects to Polars DataFrames for flexible data analysis: - Transform continuous EEG/MEG recordings to long-format DataFrames - Automatic metadata integration from epochs - Analyze neural data with modern DataFrame operations - Export to CSV, Parquet, or use with other analysis tools
Key functions: mne_raw_to_polars, mne_epochs_to_polars
Additional Examples
Time Series Plotting
Learn how to create interactive time series visualizations with support for large datasets.
Statistical Analysis
Examples of statistical plotting and significance testing.
Example from Repository
The examples/ folder contains runnable Python scripts:
resampler_example.py- Demonstrates plotly-resampler integration
Running Examples
Clone the repository and run examples:
git clone https://github.com/matthiasdold/mdu.git
cd mdu
pip install -e ".[all]"
python examples/resampler_example.pyJupyter Notebooks
You can also run examples in Jupyter:
pip install jupyter
jupyter notebookThen create a new notebook and import:
import mdu
from mdu.plotly import html_grids, stats, multiline, shared