Skip to content

Commit a641906

Browse files
committed
Added argument for showing/hiding the sample size in labels and updated readme
1 parent 2d8d1f9 commit a641906

File tree

6 files changed

+30
-20
lines changed

6 files changed

+30
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ citation](https://zenodo.org/badge/DOI/10.1038/s41592-019-0470-3.svg)](https://r
1515
## Recent Version Update
1616

1717
We are proud to announce **DABEST Version Dadar (v2025.03.14)** This new
18-
version of the DABEST Python library provides several new features and
18+
version of the DABEST Python library includes several new features and
1919
performance improvements. It’s a big one!
2020

2121
1. **Python 3.13 Support**: DABEST now supports Python 3.10-3.13.

dabest/_effsize_objects.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,7 @@ def plot(
11381138
err_color=None,
11391139
float_contrast=True,
11401140
show_pairs=True,
1141+
show_sample_size=True,
11411142
show_delta2=True,
11421143
show_mini_meta=True,
11431144
group_summaries=None,
@@ -1263,6 +1264,8 @@ def plot(
12631264
If the data is paired, whether or not to show the raw data as a
12641265
swarmplot, or as slopegraph, with a line joining each pair of
12651266
observations.
1267+
show_sample_size : boolean, default True
1268+
Whether or not to display the sample size of each group in the axis label.
12661269
show_delta2, show_mini_meta : boolean, default True
12671270
If delta-delta or mini-meta delta is calculated, whether or not to
12681271
show the delta-delta plot or mini-meta plot.

dabest/plotter.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def effectsize_df_plotter(effectsize_df: object, **plot_kwargs) -> matplotlib.fi
3939
ci=None, ci_type='bca', err_color=None,
4040
float_contrast=True,
4141
show_pairs=True,
42+
show_sample_size=True,
4243
show_delta2=True,
4344
group_summaries=None,
4445
fig_size=None,
@@ -290,15 +291,16 @@ def effectsize_df_plotter(effectsize_df: object, **plot_kwargs) -> matplotlib.fi
290291
)
291292

292293
# Add the counts to the rawdata axes xticks.
293-
add_counts_to_ticks(
294-
plot_data = plot_data,
295-
xvar = xvar,
296-
yvar = yvar,
297-
rawdata_axes = rawdata_axes,
298-
plot_kwargs = plot_kwargs,
299-
flow = sankey_kwargs["flow"],
300-
horizontal = horizontal,
301-
)
294+
if plot_kwargs['show_sample_size']:
295+
add_counts_to_ticks(
296+
plot_data = plot_data,
297+
xvar = xvar,
298+
yvar = yvar,
299+
rawdata_axes = rawdata_axes,
300+
plot_kwargs = plot_kwargs,
301+
flow = sankey_kwargs["flow"],
302+
horizontal = horizontal,
303+
)
302304

303305
# Add counts to prop plots (embedded in the plot bars)
304306
if proportional and plot_kwargs['prop_sample_counts'] and sankey_kwargs["flow"]:

nbs/API/effsize_objects.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,7 @@
13381338
" err_color=None,\n",
13391339
" float_contrast=True,\n",
13401340
" show_pairs=True,\n",
1341+
" show_sample_size=True,\n",
13411342
" show_delta2=True,\n",
13421343
" show_mini_meta=True,\n",
13431344
" group_summaries=None,\n",
@@ -1463,6 +1464,8 @@
14631464
" If the data is paired, whether or not to show the raw data as a\n",
14641465
" swarmplot, or as slopegraph, with a line joining each pair of\n",
14651466
" observations.\n",
1467+
" show_sample_size : boolean, default True\n",
1468+
" Whether or not to display the sample size of each group in the axis label.\n",
14661469
" show_delta2, show_mini_meta : boolean, default True\n",
14671470
" If delta-delta or mini-meta delta is calculated, whether or not to\n",
14681471
" show the delta-delta plot or mini-meta plot.\n",

nbs/API/plotter.ipynb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
" ci=None, ci_type='bca', err_color=None,\n",
9797
" float_contrast=True,\n",
9898
" show_pairs=True,\n",
99+
" show_sample_size=True,\n",
99100
" show_delta2=True,\n",
100101
" group_summaries=None,\n",
101102
" fig_size=None,\n",
@@ -347,15 +348,16 @@
347348
" )\n",
348349
"\n",
349350
" # Add the counts to the rawdata axes xticks.\n",
350-
" add_counts_to_ticks(\n",
351-
" plot_data = plot_data, \n",
352-
" xvar = xvar, \n",
353-
" yvar = yvar, \n",
354-
" rawdata_axes = rawdata_axes, \n",
355-
" plot_kwargs = plot_kwargs,\n",
356-
" flow = sankey_kwargs[\"flow\"],\n",
357-
" horizontal = horizontal,\n",
358-
" )\n",
351+
" if plot_kwargs['show_sample_size']:\n",
352+
" add_counts_to_ticks(\n",
353+
" plot_data = plot_data, \n",
354+
" xvar = xvar, \n",
355+
" yvar = yvar, \n",
356+
" rawdata_axes = rawdata_axes, \n",
357+
" plot_kwargs = plot_kwargs,\n",
358+
" flow = sankey_kwargs[\"flow\"],\n",
359+
" horizontal = horizontal,\n",
360+
" )\n",
359361
"\n",
360362
" # Add counts to prop plots (embedded in the plot bars)\n",
361363
" if proportional and plot_kwargs['prop_sample_counts'] and sankey_kwargs[\"flow\"]:\n",

nbs/read_me.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"source": [
3030
"## Recent Version Update\n",
3131
"\n",
32-
"We are proud to announce **DABEST Version Dadar (v2025.03.14)** This new version of the DABEST Python library provides several new features and performance improvements. It's a big one!\n",
32+
"We are proud to announce **DABEST Version Dadar (v2025.03.14)** This new version of the DABEST Python library includes several new features and performance improvements. It's a big one!\n",
3333
"\n",
3434
"1. **Python 3.13 Support**: DABEST now supports Python 3.10-3.13.\n",
3535
"\n",

0 commit comments

Comments
 (0)