From 59b3c8c231498e234ff23c14bda172ce669e91a9 Mon Sep 17 00:00:00 2001 From: Nicole Lee Date: Fri, 24 Jul 2026 15:40:56 +0800 Subject: [PATCH 1/2] SD to BSE update All prop plots and sankey plots were correctly amended to have "sd" changed to 'bse' to match what the code computes for --- nbs/02-about.ipynb | 2 +- nbs/API/effsize_objects.ipynb | 2 +- nbs/API/plot_tools.ipynb | 7 +++---- nbs/tutorials/04-proportion_plot.ipynb | 10 +++++++--- nbs/tutorials/08-plot_aesthetics.ipynb | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/nbs/02-about.ipynb b/nbs/02-about.ipynb index 812fd714..28da38c5 100644 --- a/nbs/02-about.ipynb +++ b/nbs/02-about.ipynb @@ -32,7 +32,7 @@ "\n", "- Statistics supervision by Hyungwon Choi\n", "\n", - "- Alpha testers from the Claridge-Chang lab: [Sangyu Xu](https://github.com/sangyu), [Xianyuan Zhang](https://github.com/XYZfar), [Farhan Mohammad](https://github.com/farhan8igib), Jurga Mituzaitė, Stanislav Ott, Tayfun Tumkaya, Jonathan Anns, Nicole Lee and Yishan Mai.\n", + "- Alpha testers from the Claridge-Chang lab: [Sangyu Xu](https://github.com/sangyu), [Xianyuan Zhang](https://github.com/XYZfar), [Farhan Mohammad](https://github.com/farhan8igib), Jurga Mituzaitė, Stanislav Ott, [Tayfun Tumkaya](https://github.com/ttumkaya), [Jonathan Anns](https://github.com/JAnns98), [Nicole Lee](https://github.com/mnicolee) and [Yishan Mai](https://github.com/maiyishan).\n", "\n", "- DizietAsahi ([DizietAsahi](https://github.com/DizietAsahi)) with [PR #86](https://github.com/ACCLAB/DABEST-python/pull/86): Fix bugs in slopegraph and reference line keyword parsing.\n", "\n", diff --git a/nbs/API/effsize_objects.ipynb b/nbs/API/effsize_objects.ipynb index 1d200a2e..22fe2412 100644 --- a/nbs/API/effsize_objects.ipynb +++ b/nbs/API/effsize_objects.ipynb @@ -1515,7 +1515,7 @@ " group_summaries : ['mean_sd', 'median_quartiles', 'None'], default \"mean_sd\".\n", " Plots the summary statistics for each group. If 'mean_sd', then\n", " the mean and standard deviation of each group is plotted as a\n", - " notched line beside each group. If 'median_quantiles', then the\n", + " notched line beside each group. For proportion and Sankey plots, this error is the binomial standard error (BSE), sqrt(p(1-p)/n), not the SD. If 'median_quantiles', then the\n", " median and 25th and 75th percentiles of each group is plotted\n", " instead. If 'None', the summaries are not shown.\n", " fig_size : tuple, default None\n", diff --git a/nbs/API/plot_tools.ipynb b/nbs/API/plot_tools.ipynb index 1ab8cddf..3e876553 100644 --- a/nbs/API/plot_tools.ipynb +++ b/nbs/API/plot_tools.ipynb @@ -121,7 +121,7 @@ " data: pd.DataFrame, # This DataFrame should be in 'long' format.\n", " x: str, # x column to be plotted.\n", " y: str, # y column to be plotted.\n", - " type: str = \"mean_sd\", # Choose from ['mean_sd', 'median_quartiles']. Plots the summary statistics for each group. If 'mean_sd', then the mean and standard deviation of each group is plotted as a gapped line. If 'median_quantiles', then the median and 25th and 75th percentiles of each group is plotted instead.\n", + " type: str = \"mean_sd\", # Choose from ['mean_sd', 'median_quartiles']. Plots the summary statistics for each group. If 'mean_sd', then the mean and standard deviation of each group is plotted as a gapped line. For proportion and Sankey plots, the error shown is the binomial standard error (BSE), sqrt(p(1-p)/n), rather than the SD. If 'median_quantiles', then the median and 25th and 75th percentiles of each group is plotted instead.\n", " offset: float = 0.2, # Give a single float (that will be used as the x-offset of all gapped lines), or an iterable containing the list of x-offsets.\n", " ax=None, # If a matplotlib Axes object is specified, the gapped lines will be plotted in order on this axes. If None, the current axes (plt.gca()) is used.\n", " line_color=\"black\", # The color of the gapped lines.\n", @@ -136,11 +136,10 @@ "):\n", " \"\"\"\n", " Function to plot the standard deviations as vertical errorbars.\n", + " For proportion and Sankey plots, the vertical bars instead show the\n", + " BSE of the proportion.\n", " The mean is a gap defined by negative space.\n", "\n", - " This function combines the functionality of gapped_lines(),\n", - " proportional_error_bar(), and sankey_error_bar().\n", - "\n", " \"\"\"\n", "\n", " if gap_width_percent < 0 or gap_width_percent > 100:\n", diff --git a/nbs/tutorials/04-proportion_plot.ipynb b/nbs/tutorials/04-proportion_plot.ipynb index 69a9afbf..22dea9f6 100644 --- a/nbs/tutorials/04-proportion_plot.ipynb +++ b/nbs/tutorials/04-proportion_plot.ipynb @@ -646,7 +646,7 @@ "id": "243a1a0b", "metadata": {}, "source": [ - "Instead of a Gardner-Altman plot, you can generate a **Cumming estimation plot** by setting ``float_contrast=False`` in the ``.plot()`` method. This will plot the bootstrap effect sizes below the raw data." + "Instead of a Gardner-Altman plot, you can generate a **Cumming estimation plot** by setting ``float_contrast=False`` in the ``.plot()`` method. This will plot the bootstrap effect sizes below the raw data. The gapped lines show the mean (gap) and the binomial standard error (BSE) of each group." ] }, { @@ -1098,7 +1098,7 @@ "id": "17832542", "metadata": {}, "source": [ - "The Sankey plots for paired proportions also supports the ``float_contrast`` parameter, which can be set to ``False`` to produce a **Cumming estimation plot**.\n" + "The Sankey plots for paired proportions also supports the ``float_contrast`` parameter, which can be set to ``False`` to produce a **Cumming estimation plot**. The gapped lines show the mean and the BSE of each group.\n" ] }, { @@ -1687,7 +1687,11 @@ } ], "source": [ - "two_groups_unpaired.mean_diff.plot(barplot_kwargs={\"alpha\":0.5, \"edgecolor\":\"red\", \"linewidth\":2, 'errorbar': ('sd', 0.1)});" + "# Note on error bars for proportion plots: you can pass a seaborn `errorbar`\n", + "# argument through barplot_kwargs, such as 'errorbar': ('sd', 1) for the standard\n", + "# deviation. DABEST's proportion plots instead show the BSE,\n", + "# √(p(1-p)/n).\n", + "two_groups_unpaired.mean_diff.plot(barplot_kwargs={\"alpha\":0.5, \"edgecolor\":\"red\", \"linewidth\":2});" ] }, { diff --git a/nbs/tutorials/08-plot_aesthetics.ipynb b/nbs/tutorials/08-plot_aesthetics.ipynb index 450cdd55..5d20a4aa 100644 --- a/nbs/tutorials/08-plot_aesthetics.ipynb +++ b/nbs/tutorials/08-plot_aesthetics.ipynb @@ -1299,7 +1299,7 @@ "source": [ "The type of group summary can be specified via `group_summaries` in the `.plot()` method and must be one of these: `'median_quartiles'`, `'mean_sd'`, `None`.\n", "\n", - "By default, the group summary is set to `'mean_sd'`." + "By default, the group summary is set to `'mean_sd'`. For proportion and Sankey plots, the `'mean_sd'` gapped line shows the BSE, not the standard deviation." ] }, { From d413232720a00a58b0b9edafd1e7999be053266e Mon Sep 17 00:00:00 2001 From: Nicole Lee Date: Fri, 24 Jul 2026 15:45:36 +0800 Subject: [PATCH 2/2] Updating the .py files --- dabest/_effsize_objects.py | 2 +- dabest/plot_tools.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dabest/_effsize_objects.py b/dabest/_effsize_objects.py index fce3e822..6a3cb280 100644 --- a/dabest/_effsize_objects.py +++ b/dabest/_effsize_objects.py @@ -1304,7 +1304,7 @@ def plot( group_summaries : ['mean_sd', 'median_quartiles', 'None'], default "mean_sd". Plots the summary statistics for each group. If 'mean_sd', then the mean and standard deviation of each group is plotted as a - notched line beside each group. If 'median_quantiles', then the + notched line beside each group. For proportion and Sankey plots, this error is the binomial standard error (BSE), sqrt(p(1-p)/n), not the SD. If 'median_quantiles', then the median and 25th and 75th percentiles of each group is plotted instead. If 'None', the summaries are not shown. fig_size : tuple, default None diff --git a/dabest/plot_tools.py b/dabest/plot_tools.py index 45cb2134..0b6c8afa 100644 --- a/dabest/plot_tools.py +++ b/dabest/plot_tools.py @@ -70,7 +70,7 @@ def error_bar( data: pd.DataFrame, # This DataFrame should be in 'long' format. x: str, # x column to be plotted. y: str, # y column to be plotted. - type: str = "mean_sd", # Choose from ['mean_sd', 'median_quartiles']. Plots the summary statistics for each group. If 'mean_sd', then the mean and standard deviation of each group is plotted as a gapped line. If 'median_quantiles', then the median and 25th and 75th percentiles of each group is plotted instead. + type: str = "mean_sd", # Choose from ['mean_sd', 'median_quartiles']. Plots the summary statistics for each group. If 'mean_sd', then the mean and standard deviation of each group is plotted as a gapped line. For proportion and Sankey plots, the error shown is the binomial standard error (BSE), sqrt(p(1-p)/n), rather than the SD. If 'median_quantiles', then the median and 25th and 75th percentiles of each group is plotted instead. offset: float = 0.2, # Give a single float (that will be used as the x-offset of all gapped lines), or an iterable containing the list of x-offsets. ax=None, # If a matplotlib Axes object is specified, the gapped lines will be plotted in order on this axes. If None, the current axes (plt.gca()) is used. line_color="black", # The color of the gapped lines. @@ -85,11 +85,10 @@ def error_bar( ): """ Function to plot the standard deviations as vertical errorbars. + For proportion and Sankey plots, the vertical bars instead show the + BSE of the proportion. The mean is a gap defined by negative space. - This function combines the functionality of gapped_lines(), - proportional_error_bar(), and sankey_error_bar(). - """ if gap_width_percent < 0 or gap_width_percent > 100: