Skip to content

Commit 3890c06

Browse files
committed
updated tutorials, readme, and forest plot effect size options
> Updated Readme > Updated Tutorials > Added more effect size options to forest plot for delta plotting
1 parent 896f276 commit 3890c06

13 files changed

Lines changed: 178 additions & 154 deletions

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ performance improvements. It’s a big one!
2222

2323
2. **Horizontal Plots**: Users can now create horizontal layout plots,
2424
providing compact data visualization. This can be achieved by
25-
setting `horizontal=True` in the `plot()` method. See the
26-
[Horizontal Plots](../tutorials/08-horizontal_plot.html) tutorial
25+
setting `horizontal=True` in the `.plot()` method. See the
26+
[Horizontal Plots tutorial](../tutorials/08-horizontal_plot.html)
2727
for more details.
2828

2929
3. **Forest Plots**: Forest plots provide a simple and intuitive way to
3030
visualize many delta-delta (or delta *g*), mini-meta, or regular
3131
delta effect sizes at once from multiple different dabest objects
32-
without presenting the raw data. See the [Forest
33-
Plots](../tutorials/07-forest_plot.html) tutorial for more details.
32+
without presenting the raw data. See the [Forest Plots
33+
tutorial](../tutorials/07-forest_plot.html) for more details.
3434

3535
4. **Gridkey**: Users can now represent experimental labels in a
3636
‘gridkey’ table. This can be accessed with the `gridkey` parameter
37-
in the `plot()` method. See the gridkey section in the [Plot
38-
Aesthetics](../tutorials/09-plot_aesthetics.html) tutorial for more
37+
in the `.plot()` method. See the gridkey section in the [Plot
38+
Aesthetics tutorial](../tutorials/09-plot_aesthetics.html) for more
3939
details.
4040

4141
5. **Other Visualization Improvements**:
@@ -53,15 +53,15 @@ performance improvements. It’s a big one!
5353
control) in the contrast axis. They provide a visual
5454
representation of the differences between groups.
5555

56-
- **Summary Bars**: Optional horizontal bars that can be added to
57-
emphasize a specific effect size across the entire contrast
58-
axis. Unlike raw and contrast bars, these span horizontally and
59-
are not displayed by default.
56+
- **Summary Bars**: Optional bars that can be added to emphasize a
57+
specific effect size across the entire contrast axis. Unlike raw
58+
and contrast bars, these span horizontally (or vertically if
59+
`horizontal=True`) and are not displayed by default.
6060

61-
By default, plots show raw and contrast bars. Users can
62-
customize these bars and add summary bars as needed. For
63-
detailed customization instructions, please refer to the [Plot
64-
Aesthetics](../tutorials/09-plot_aesthetics.html) tutorial.
61+
Raw and contrast bars are shown by default. Users can customize
62+
these bars and add summary bars as needed. For detailed
63+
customization instructions, please refer to the [Plot Aesthetics
64+
tutorial](../tutorials/09-plot_aesthetics.html).
6565

6666
- **Tighter spacing in Delta-Delta and Mini-Meta Plots**: We have
6767
adjusted the spacing of delta-delta and mini-meta plots to reduce
@@ -77,31 +77,30 @@ performance improvements. It’s a big one!
7777

7878
- **Proportion Plots Sample Sizes**: The sample size of each binary
7979
option for each group can now be displayed. These can be toggled
80-
on or off via the `prop_sample_counts` parameter.
80+
on/off via the `prop_sample_counts` parameter.
8181

8282
- **Effect Size Lines for Paired Plots**: Along with lines
8383
connecting paired observed values, the paired plots now also
8484
display lines linking the effect sizes within a group in the
85-
contrast axes. These lines can be toggled on or off via the
85+
contrast axes. These lines can be toggled on/off via the
8686
`contrast_paired_lines` parameter.
8787

8888
- **Baseline Error Curves**: To represent the baseline/control group
8989
in the contrast axes, it is now possible to plot the baseline dot
9090
and the baseline error curve. The dot is shown by default, while
91-
the curve can be toggled on/off by the user (via the
92-
`show_baseline_ec` parameter). This dot helps make it clear where
93-
the baseline comes from i.e. the control minus itself. The
94-
baseline error curve can be used to show that the baseline itself
95-
is an estimate inferred from the observed values of the control
96-
data.
91+
the curve can be toggled on/off via the `show_baseline_ec`
92+
parameter. This dot helps make it clear where the baseline comes
93+
from i.e. the control minus itself. The baseline error curve can
94+
be used to show that the baseline itself is an estimate inferred
95+
from the observed values of the control data.
9796

9897
- **Delta Text**: Effect-size deltas (e.g. mean differences) are now
9998
displayed as numerals next to their respective effect size. This
100-
can be toggled on or off via the `delta_text` parameter.
99+
can be toggled on/off via the `delta_text` parameter.
101100

102101
- **Empty Circle Color Palette**: A new swarmplot color palette
103102
modification is available for unpaired plots via the
104-
`empty_circle` parameter in the `plot()` method. This option
103+
`empty_circle` parameter in the `.plot()` method. This option
105104
modifies the two-group swarmplots to have empty circles for the
106105
control group and filled circles for the experimental group.
107106

@@ -117,13 +116,14 @@ performance improvements. It’s a big one!
117116
code, we have made several updates to the documentation and
118117
terminology to improve clarity and consistency. For example:
119118

120-
- Many plot arguments have been adjusted to bring more clarity and
119+
- Plot arguments have been adjusted to bring more clarity and
121120
consistency in naming. Arguments relating to the rawdata plot
122121
axis will now be typically referred to with `raw` while
123122
arguments relating to the contrast axis will be referred to with
124123
`contrast`. For example, `raw_label` replaces `swarm_label` and
125124
`bar_label`. The various kwargs relating to each different type
126125
of plot (e.g., `swarmplot_kwargs`) remain unchanged.
126+
127127
- The method to utilise the Delta *g* effect size is now via the
128128
.hedges_g.plot() method rather than creating a whole new Delta_g
129129
object as before. The functionality remains the same, it plots

dabest/forest_plot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ def check_for_errors(**kwargs):
164164
raise TypeError("`fig_size` must be a tuple or list of two positive integers.")
165165

166166
# Effect size
167-
effect_size_options = ['mean_diff', 'hedges_g', 'delta_g']
167+
effect_size_options = ['mean_diff', 'median_diff', 'cohens_d', 'cohens_h', 'cliffs_delta', 'hedges_g', 'delta_g']
168168
if not isinstance(effect_size, str) or effect_size not in effect_size_options:
169-
raise TypeError("The `effect_size` argument must be a string and please choose from the following effect sizes: `mean_diff`, `hedges_g`, or `delta_g`.")
169+
raise TypeError("The `effect_size` argument must be a string and please choose from the following effect sizes: 'mean_diff', 'median_diff', 'cohens_d', 'cohens_h', 'cliffs_delta', 'hedges_g', 'delta_g'.")
170170
if data[0].is_mini_meta and effect_size != 'mean_diff':
171171
raise ValueError("The `effect_size` argument must be `mean_diff` for mini-meta analyses.")
172172
if data[0].delta2 and effect_size not in ['mean_diff', 'hedges_g', 'delta_g']:
@@ -646,6 +646,10 @@ def forest_plot(
646646
if ylabel is None:
647647
effect_attr_map = {
648648
"mean_diff": "Mean Difference",
649+
"median_diff": "Median Difference",
650+
"cohens_d": "Cohen's d",
651+
"cohens_h": "Cohen's h",
652+
"cliffs_delta": "Cliff's delta",
649653
"hedges_g": "Hedges' g",
650654
"delta_g": "Delta g"
651655
}

nbs/01-getting_started.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"source": [
6565
"\n",
6666
"\n",
67-
"Python 3.11 is strongly recommended. DABEST has also been tested with Python 3.10 and onwards.\n",
67+
"Python 3.11 is recommended. DABEST has also been tested with Python 3.10 and onwards.\n",
6868
"\n",
6969
"In addition, the following packages are also required (listed with their minimal versions):\n",
7070
"\n",

nbs/API/forest_plot.ipynb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@
224224
" raise TypeError(\"`fig_size` must be a tuple or list of two positive integers.\")\n",
225225
"\n",
226226
" # Effect size\n",
227-
" effect_size_options = ['mean_diff', 'hedges_g', 'delta_g']\n",
227+
" effect_size_options = ['mean_diff', 'median_diff', 'cohens_d', 'cohens_h', 'cliffs_delta', 'hedges_g', 'delta_g']\n",
228228
" if not isinstance(effect_size, str) or effect_size not in effect_size_options:\n",
229-
" raise TypeError(\"The `effect_size` argument must be a string and please choose from the following effect sizes: `mean_diff`, `hedges_g`, or `delta_g`.\")\n",
229+
" raise TypeError(\"The `effect_size` argument must be a string and please choose from the following effect sizes: 'mean_diff', 'median_diff', 'cohens_d', 'cohens_h', 'cliffs_delta', 'hedges_g', 'delta_g'.\")\n",
230230
" if data[0].is_mini_meta and effect_size != 'mean_diff':\n",
231231
" raise ValueError(\"The `effect_size` argument must be `mean_diff` for mini-meta analyses.\")\n",
232232
" if data[0].delta2 and effect_size not in ['mean_diff', 'hedges_g', 'delta_g']:\n",
@@ -706,6 +706,10 @@
706706
" if ylabel is None:\n",
707707
" effect_attr_map = {\n",
708708
" \"mean_diff\": \"Mean Difference\",\n",
709+
" \"median_diff\": \"Median Difference\", \n",
710+
" \"cohens_d\": \"Cohen's d\",\n",
711+
" \"cohens_h\": \"Cohen's h\",\n",
712+
" \"cliffs_delta\": \"Cliff's delta\",\n",
709713
" \"hedges_g\": \"Hedges' g\",\n",
710714
" \"delta_g\": \"Delta g\"\n",
711715
" }\n",

nbs/read_me.ipynb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,45 +33,45 @@
3333
"\n",
3434
"1. **Python 3.13 Support**: DABEST now supports Python 3.10—3.13.\n",
3535
"\n",
36-
"2. **Horizontal Plots**: Users can now create horizontal layout plots, providing compact data visualization. This can be achieved by setting `horizontal=True` in the `plot()` method. See the [Horizontal Plots](../tutorials/08-horizontal_plot.html) tutorial for more details.\n",
36+
"2. **Horizontal Plots**: Users can now create horizontal layout plots, providing compact data visualization. This can be achieved by setting `horizontal=True` in the `.plot()` method. See the [Horizontal Plots tutorial](../tutorials/08-horizontal_plot.html) for more details.\n",
3737
"\n",
38-
"3. **Forest Plots**: Forest plots provide a simple and intuitive way to visualize many delta-delta (or delta *g*), mini-meta, or regular delta effect sizes at once from multiple different dabest objects without presenting the raw data. See the [Forest Plots](../tutorials/07-forest_plot.html) tutorial for more details.\n",
38+
"3. **Forest Plots**: Forest plots provide a simple and intuitive way to visualize many delta-delta (or delta *g*), mini-meta, or regular delta effect sizes at once from multiple different dabest objects without presenting the raw data. See the [Forest Plots tutorial](../tutorials/07-forest_plot.html) for more details.\n",
3939
"\n",
40-
"4. **Gridkey**: Users can now represent experimental labels in a ‘gridkey’ table. This can be accessed with the `gridkey` parameter in the `plot()` method. See the gridkey section in the [Plot Aesthetics](../tutorials/09-plot_aesthetics.html) tutorial for more details.\n",
40+
"4. **Gridkey**: Users can now represent experimental labels in a ‘gridkey’ table. This can be accessed with the `gridkey` parameter in the `.plot()` method. See the gridkey section in the [Plot Aesthetics tutorial](../tutorials/09-plot_aesthetics.html) for more details.\n",
4141
"\n",
4242
"5. **Other Visualization Improvements**:\n",
4343
" - **Raw, Contrast, and Summary bars**: Our visualization package now includes three types of customizable bars to enhance data interpretation:\n",
4444
" - **Raw Bars**: Colored rectangles that extend from the zero line to the mean of each group's raw data. These bars visually highlight the central tendency of the raw data.\n",
4545
" - **Contrast Bars**: Similar to raw bars, these highlight the effect size difference between two groups (typically test and control) in the contrast axis. They provide a visual representation of the differences between groups.\n",
46-
" - **Summary Bars**: Optional horizontal bars that can be added to emphasize a specific effect size across the entire contrast axis. Unlike raw and contrast bars, these span horizontally and are not displayed by default.\n",
46+
" - **Summary Bars**: Optional bars that can be added to emphasize a specific effect size across the entire contrast axis. Unlike raw and contrast bars, these span horizontally (or vertically if `horizontal=True`) and are not displayed by default.\n",
4747
"\n",
48-
" By default, plots show raw and contrast bars. Users can customize these bars and add summary bars as needed. For detailed customization instructions, please refer to the [Plot Aesthetics](../tutorials/09-plot_aesthetics.html) tutorial.\n",
48+
" Raw and contrast bars are shown by default. Users can customize these bars and add summary bars as needed. For detailed customization instructions, please refer to the [Plot Aesthetics tutorial](../tutorials/09-plot_aesthetics.html).\n",
4949
"\n",
5050
" - **Tighter spacing in Delta-Delta and Mini-Meta Plots**: We have adjusted the spacing of delta-delta and mini-meta plots to reduce whitespace. The new format brings the overall effect size closer to the two-groups effect sizes. In addition, delta-delta plots now have a gap in the zero line to separate the delta-delta from the ∆ effect sizes.\n",
5151
"\n",
5252
" - **Delta-Delta Effect Sizes for Proportion Plots**: In addition to continuous data, delta-delta plots now support binary data (proportions). This means that 2-way designs for binary outcomes can be analyzed with DABEST.\n",
5353
"\n",
54-
" - **Proportion Plots Sample Sizes**: The sample size of each binary option for each group can now be displayed. These can be toggled on or off via the `prop_sample_counts` parameter.\n",
54+
" - **Proportion Plots Sample Sizes**: The sample size of each binary option for each group can now be displayed. These can be toggled on/off via the `prop_sample_counts` parameter.\n",
5555
"\n",
56-
" - **Effect Size Lines for Paired Plots**: Along with lines connecting paired observed values, the paired plots now also display lines linking the effect sizes within a group in the contrast axes. These lines can be toggled on or off via the `contrast_paired_lines` parameter.\n",
56+
" - **Effect Size Lines for Paired Plots**: Along with lines connecting paired observed values, the paired plots now also display lines linking the effect sizes within a group in the contrast axes. These lines can be toggled on/off via the `contrast_paired_lines` parameter.\n",
5757
"\n",
58-
" - **Baseline Error Curves**: To represent the baseline/control group in the contrast axes, it is now possible to plot the baseline dot and the baseline error curve. The dot is shown by default, while the curve can be toggled on/off by the user (via the `show_baseline_ec` parameter). This dot helps make it clear where the baseline comes from i.e. the control minus itself. The baseline error curve can be used to show that the baseline itself is an estimate inferred from the observed values of the control data. \n",
58+
" - **Baseline Error Curves**: To represent the baseline/control group in the contrast axes, it is now possible to plot the baseline dot and the baseline error curve. The dot is shown by default, while the curve can be toggled on/off via the `show_baseline_ec` parameter. This dot helps make it clear where the baseline comes from i.e. the control minus itself. The baseline error curve can be used to show that the baseline itself is an estimate inferred from the observed values of the control data. \n",
5959
"\n",
60-
" - **Delta Text**: Effect-size deltas (e.g. mean differences) are now displayed as numerals next to their respective effect size. This can be toggled on or off via the `delta_text` parameter.\n",
60+
" - **Delta Text**: Effect-size deltas (e.g. mean differences) are now displayed as numerals next to their respective effect size. This can be toggled on/off via the `delta_text` parameter.\n",
6161
"\n",
62-
" - **Empty Circle Color Palette**: A new swarmplot color palette modification is available for unpaired plots via the `empty_circle` parameter in the `plot()` method. This option modifies the two-group swarmplots to have empty circles for the control group and filled circles for the experimental group.\n",
62+
" - **Empty Circle Color Palette**: A new swarmplot color palette modification is available for unpaired plots via the `empty_circle` parameter in the `.plot()` method. This option modifies the two-group swarmplots to have empty circles for the control group and filled circles for the experimental group.\n",
6363
"\n",
6464
"6. **Miscellaneous Improvements & Adjustments**\n",
6565
" - **Numba for Speed Improvements**: We have added [Numba](https://numba.pydata.org/) to speed up the various calculations in DABEST. Precalculations will be performed during import, which will help speed up the subsequent loading and plotting of data.\n",
6666
" \n",
6767
" - **Terminology/Naming Updates**: During the refactoring of the code, we have made several updates to the documentation and terminology to improve clarity and consistency. For example:\n",
68-
" - Many plot arguments have been adjusted to bring more clarity and consistency in naming. Arguments relating to the rawdata plot axis will now be typically referred to with `raw` while arguments relating to the contrast axis will be referred to with `contrast`. For example, `raw_label` replaces `swarm_label` and `bar_label`. The various kwargs relating to each different type of plot (e.g., `swarmplot_kwargs`) remain unchanged.\n",
68+
" - Plot arguments have been adjusted to bring more clarity and consistency in naming. Arguments relating to the rawdata plot axis will now be typically referred to with `raw` while arguments relating to the contrast axis will be referred to with `contrast`. For example, `raw_label` replaces `swarm_label` and `bar_label`. The various kwargs relating to each different type of plot (e.g., `swarmplot_kwargs`) remain unchanged.\n",
69+
" \n",
6970
" - The method to utilise the Delta *g* effect size is now via the .hedges_g.plot() method rather than creating a whole new Delta_g object as before. The functionality remains the same, it plots hedges_g effect sizes and then the Delta *g* effect size alongside these (if a delta-delta experiment was loaded correctly).\n",
7071
"\n",
7172
" - **Updated Tutorial Pages**: We have updated the tutorial pages to reflect the new features and changes. The tutorial pages are now more comprehensive and (hopefully!) more intuitive!\n",
7273
"\n",
73-
" - **Results Dataframe for Delta-Delta and Mini-Meta Plots**: A results dataframe can now be extracted for both the delta-delta and mini-meta effect size data (similar to the results dataframe for the regular effect sizes). These can be found via the `.results` attribute of the `.delta_delta` or `.mini_meta` object.\n",
74-
"\n"
74+
" - **Results Dataframe for Delta-Delta and Mini-Meta Plots**: A results dataframe can now be extracted for both the delta-delta and mini-meta effect size data (similar to the results dataframe for the regular effect sizes). These can be found via the `.results` attribute of the `.delta_delta` or `.mini_meta` object."
7575
]
7676
},
7777
{

0 commit comments

Comments
 (0)