From 41aced1f1f35715a90c0a4046782a6c1b1d8b674 Mon Sep 17 00:00:00 2001 From: Mai Yishan Date: Thu, 20 Aug 2026 10:13:21 +0800 Subject: [PATCH 1/2] Bug fix for issue #218 Bug fix: Changes bootstraps_color_by_group check in misc_tools to work the same way for both paired data and unpaired data (since unpaired data was working), with the exception of delta-delta and Sankey --- README.md | 4 ++-- dabest/misc_tools.py | 17 ++++++++++++----- nbs/API/misc_tools.ipynb | 17 ++++++++++++----- pyproject.toml | 2 +- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 37a8f29a..7fd79e06 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## Recent Version Update -**✨ DABEST “Bingka” v2025.10.20 for Python is now released! ✨** +**✨ DABEST "Bingka" v2025.10.20 for Python is now released! ✨** Dear DABEST users, The latest version of the DABEST Python library brings new visualizations, refined plots, and improved accuracy. @@ -20,7 +20,7 @@ The latest version of the DABEST Python library brings new visualizations, refin Introducing **Whorlmap**, a new way to visualize effect sizes from multiple comparisons in a compact, grid-based format. - Whorlmaps condense information from the full bootstrap distributions of many contrast objects into a **2D heatmap-style grid of “whorled” cells**. This provides an overview of the entire dataset while preserving the underlying distributional detail. + Whorlmaps condense information from the full bootstrap distributions of many contrast objects into a **2D heatmap-style grid of "whorled" cells**. This provides an overview of the entire dataset while preserving the underlying distributional detail. They are especially useful for large-scale or multi-condition experiments, serving as a **space-efficient alternative to stacked forest plots**. diff --git a/dabest/misc_tools.py b/dabest/misc_tools.py index 4060b7ca..77cd0c42 100644 --- a/dabest/misc_tools.py +++ b/dabest/misc_tools.py @@ -555,13 +555,20 @@ def get_color_palette( color_groups = pd.unique(plot_data[color_col]) bootstraps_color_by_group = False if show_pairs: - if plot_kwargs["custom_palette"] is not None: - if delta2 or sankey: + if sankey: + bootstraps_color_by_group = False + elif plot_kwargs["custom_palette"] is not None: + if delta2: bootstraps_color_by_group = False else: - bootstraps_color_by_group = True - else: - bootstraps_color_by_group = False + if color_col is None: + color_groups = pd.unique(plot_data[xvar]) + bootstraps_color_by_group = True + else: + if color_col not in plot_data.columns: + raise KeyError("``{}`` is not a column in the data.".format(color_col)) + color_groups = pd.unique(plot_data[color_col]) + bootstraps_color_by_group = False # Handle the color palette. filled = True diff --git a/nbs/API/misc_tools.ipynb b/nbs/API/misc_tools.ipynb index 3e28644e..82fa9b33 100644 --- a/nbs/API/misc_tools.ipynb +++ b/nbs/API/misc_tools.ipynb @@ -606,13 +606,20 @@ " color_groups = pd.unique(plot_data[color_col])\n", " bootstraps_color_by_group = False\n", " if show_pairs:\n", - " if plot_kwargs[\"custom_palette\"] is not None:\n", - " if delta2 or sankey:\n", + " if sankey:\n", + " bootstraps_color_by_group = False\n", + " elif plot_kwargs[\"custom_palette\"] is not None:\n", + " if delta2:\n", " bootstraps_color_by_group = False\n", " else:\n", - " bootstraps_color_by_group = True\n", - " else:\n", - " bootstraps_color_by_group = False\n", + " if color_col is None:\n", + " color_groups = pd.unique(plot_data[xvar])\n", + " bootstraps_color_by_group = True\n", + " else:\n", + " if color_col not in plot_data.columns:\n", + " raise KeyError(\"``{}`` is not a column in the data.\".format(color_col))\n", + " color_groups = pd.unique(plot_data[color_col])\n", + " bootstraps_color_by_group = False\n", "\n", " # Handle the color palette.\n", " filled = True\n", diff --git a/pyproject.toml b/pyproject.toml index 533ba62c..289d1cf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ dev = ['pytest~=8.3.4', 'pytest-mpl~=0.17.0'] version = {attr = "dabest.__version__"} [tool.setuptools.packages.find] -include = ["dabest"] +include = ["dabest", "dabest.*"] [tool.nbdev] branch = 'master' From f854e00523dbc18bf4f7944def7ed9a47a19cafb Mon Sep 17 00:00:00 2001 From: Mai Yishan Date: Thu, 20 Aug 2026 15:04:45 +0800 Subject: [PATCH 2/2] Attempt to fix pytest failure pytest CI failing at one of the hedges' g paired plots due to color of the bootstrap distribution; reworking of bootstrap distribution color check in an attempt to fix --- dabest/misc_tools.py | 12 ++++++++---- nbs/API/misc_tools.ipynb | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dabest/misc_tools.py b/dabest/misc_tools.py index 77cd0c42..8b4c09ab 100644 --- a/dabest/misc_tools.py +++ b/dabest/misc_tools.py @@ -546,6 +546,7 @@ def get_color_palette( # Create color palette that will be shared across subplots. color_col = plot_kwargs["color_col"] + if color_col is None: color_groups = pd.unique(plot_data[xvar]) bootstraps_color_by_group = True @@ -555,11 +556,11 @@ def get_color_palette( color_groups = pd.unique(plot_data[color_col]) bootstraps_color_by_group = False if show_pairs: - if sankey: - bootstraps_color_by_group = False - elif plot_kwargs["custom_palette"] is not None: + if plot_kwargs["custom_palette"] is not None: if delta2: bootstraps_color_by_group = False + elif sankey: + bootstraps_color_by_group = False else: if color_col is None: color_groups = pd.unique(plot_data[xvar]) @@ -568,7 +569,10 @@ def get_color_palette( if color_col not in plot_data.columns: raise KeyError("``{}`` is not a column in the data.".format(color_col)) color_groups = pd.unique(plot_data[color_col]) - bootstraps_color_by_group = False + bootstraps_color_by_group = False + else: + bootstraps_color_by_group = False + # Handle the color palette. filled = True diff --git a/nbs/API/misc_tools.ipynb b/nbs/API/misc_tools.ipynb index 82fa9b33..c8e97c67 100644 --- a/nbs/API/misc_tools.ipynb +++ b/nbs/API/misc_tools.ipynb @@ -597,6 +597,7 @@ "\n", " # Create color palette that will be shared across subplots.\n", " color_col = plot_kwargs[\"color_col\"]\n", + "\n", " if color_col is None:\n", " color_groups = pd.unique(plot_data[xvar])\n", " bootstraps_color_by_group = True\n", @@ -606,11 +607,11 @@ " color_groups = pd.unique(plot_data[color_col])\n", " bootstraps_color_by_group = False\n", " if show_pairs:\n", - " if sankey:\n", - " bootstraps_color_by_group = False\n", - " elif plot_kwargs[\"custom_palette\"] is not None:\n", + " if plot_kwargs[\"custom_palette\"] is not None:\n", " if delta2:\n", " bootstraps_color_by_group = False\n", + " elif sankey:\n", + " bootstraps_color_by_group = False\n", " else:\n", " if color_col is None:\n", " color_groups = pd.unique(plot_data[xvar])\n", @@ -619,7 +620,10 @@ " if color_col not in plot_data.columns:\n", " raise KeyError(\"``{}`` is not a column in the data.\".format(color_col))\n", " color_groups = pd.unique(plot_data[color_col])\n", - " bootstraps_color_by_group = False\n", + " bootstraps_color_by_group = False \n", + " else:\n", + " bootstraps_color_by_group = False\n", + " \n", "\n", " # Handle the color palette.\n", " filled = True\n",