Skip to content

Commit d047528

Browse files
authored
Merge pull request #174 from ACCLAB/feat-asymmetric-swarmplots
Added empty_circle plot aesthetic
2 parents c080f82 + 533797c commit d047528

126 files changed

Lines changed: 4894 additions & 2923 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ _proc/
55
.gitattributes
66
.last_checked
77
.gitconfig
8+
.cursorignore
89
*.bak
910
*.log
1011
*~

dabest/_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Loading data and relevant groups"""
2+
13
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/load.ipynb.
24

35
# %% auto 0

dabest/_dabest_object.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Main class for estimating statistics and generating plots."""
2+
13
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/dabest_object.ipynb.
24

35
# %% auto 0

dabest/_delta_objects.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Auxiliary delta classes for estimating statistics and generating plots."""
2+
13
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/delta_objects.ipynb.
24

35
# %% auto 0

dabest/_effsize_objects.py

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""The auxiliary classes involved in the computations of bootstrapped effect sizes."""
2+
13
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/effsize_objects.ipynb.
24

35
# %% auto 0
@@ -971,6 +973,7 @@ def plot(
971973
contrast_ylim=None,
972974
delta2_ylim=None,
973975
swarm_side=None,
976+
empty_circle=False,
974977
custom_palette=None,
975978
swarm_desat=0.5,
976979
halfviolin_desat=1,
@@ -994,10 +997,6 @@ def plot(
994997
fig_size=None,
995998
dpi=100,
996999
ax=None,
997-
contrast_show_es=False,
998-
es_sf=2,
999-
es_fontsize=10,
1000-
contrast_show_deltas=True,
10011000
gridkey_rows=None,
10021001
gridkey_merge_pairs=False,
10031002
gridkey_show_Ns=True,
@@ -1017,6 +1016,17 @@ def plot(
10171016
fontsize_contrastxlabel=12,
10181017
fontsize_contrastylabel=12,
10191018
fontsize_delta2label=12,
1019+
#### Contrast bars and delta text and delta dots WIP ####
1020+
contrast_bars=True,
1021+
swarm_bars=True,
1022+
contrast_bars_kwargs=None,
1023+
swarm_bars_kwargs=None,
1024+
summary_bars=None,
1025+
summary_bars_kwargs=None,
1026+
delta_text=True,
1027+
delta_text_kwargs=None,
1028+
delta_dot=True,
1029+
delta_dot_kwargs=None,
10201030
):
10211031
"""
10221032
Creates an estimation plot for the effect size of interest.
@@ -1064,6 +1074,12 @@ def plot(
10641074
https://seaborn.pydata.org/generated/seaborn.cubehelix_palette.html
10651075
The named colors of matplotlib can be found here:
10661076
https://matplotlib.org/examples/color/named_colors.html
1077+
swarm_side: string, default None
1078+
The side on which points are swarmed for swarmplots ("center", "left", or "right").
1079+
empty_circle: boolean, default False
1080+
Boolean value determining if empty circles will be used for plotting of
1081+
swarmplot for control groups. Color of each individual swarm is also now
1082+
dependent on the comparison group.
10671083
swarm_desat : float, default 1
10681084
Decreases the saturation of the colors in the swarmplot by the
10691085
desired proportion. Uses `seaborn.desaturate()` to acheive this.
@@ -1159,7 +1175,39 @@ def plot(
11591175
Font size for the contrast axes ylabel.
11601176
fontsize_delta2label : float, default 12
11611177
Font size for the delta-delta axes ylabel.
1162-
1178+
1179+
1180+
contrast_bars : boolean, default True
1181+
Whether or not to display the contrast bars.
1182+
swarm_bars : boolean, default True
1183+
Whether or not to display the swarm bars.
1184+
contrast_bars_kwargs : dict, default None
1185+
Pass relevant keyword arguments to the contrast bars. Pass any keyword arguments accepted by
1186+
matplotlib.patches.Rectangle here, as a string. If None, the following keywords are passed:
1187+
{"color": None, "alpha": 0.3}
1188+
swarm_bars_kwargs : dict, default None
1189+
Pass relevant keyword arguments to the swarm bars. Pass any keyword arguments accepted by
1190+
matplotlib.patches.Rectangle here, as a string. If None, the following keywords are passed:
1191+
{"color": None, "alpha": 0.3}
1192+
1193+
summary_bars : list, default None
1194+
Pass a list of indices of the contrast objects to have summary bars displayed on the plot.
1195+
For example, [0,1] will show summary bars for the first two contrast objects.
1196+
summary_bars_kwargs: dict, default None
1197+
If None, the following keywords are passed: {"color": None, "alpha": 0.15}
1198+
delta_text : boolean, default True
1199+
Whether or not to display the text deltas.
1200+
delta_text_kwargs : dict, default None
1201+
Pass relevant keyword arguments to the delta text. Pass any keyword arguments accepted by
1202+
matplotlib.text.Text here, as a string. If None, the following keywords are passed:
1203+
{"color": None, "alpha": 1, "fontsize": 10, "ha": 'center', "va": 'center', "rotation": 0,
1204+
"x_location": 'right', "x_coordinates": None, "y_coordinates": None}
1205+
Use "x_coordinates" and "y_coordinates" if you would like to specify the text locations manually.
1206+
delta_dot : boolean, default True
1207+
Whether or not to display the delta dots on paired or repeated measure plots.
1208+
delta_dot_kwargs : dict, default None
1209+
Pass relevant keyword arguments. If None, the following keywords are passed:
1210+
{"marker": "^", "alpha": 0.5, "zorder": 2, "size": 3, "side": "right"}
11631211
11641212
Returns
11651213
-------
@@ -1180,7 +1228,7 @@ def plot(
11801228
if hasattr(self, "results") is False:
11811229
self.__pre_calc()
11821230

1183-
if self.__delta2:
1231+
if self.__delta2 and not empty_circle:
11841232
color_col = self.__x2
11851233

11861234
# if self.__proportional:

dabest/_modidx.py

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,30 @@
6565
'dabest/forest_plot.py'),
6666
'dabest.forest_plot.forest_plot': ('API/forest_plot.html#forest_plot', 'dabest/forest_plot.py'),
6767
'dabest.forest_plot.load_plot_data': ('API/forest_plot.html#load_plot_data', 'dabest/forest_plot.py')},
68-
'dabest.misc_tools': { 'dabest.misc_tools.get_varname': ('API/misc_tools.html#get_varname', 'dabest/misc_tools.py'),
68+
'dabest.misc_tools': { 'dabest.misc_tools.Cumming_Plot_Aesthetic_Adjustments': ( 'API/misc_tools.html#cumming_plot_aesthetic_adjustments',
69+
'dabest/misc_tools.py'),
70+
'dabest.misc_tools.Gardner_Altman_Plot_Aesthetic_Adjustments': ( 'API/misc_tools.html#gardner_altman_plot_aesthetic_adjustments',
71+
'dabest/misc_tools.py'),
72+
'dabest.misc_tools.General_Plot_Aesthetic_Adjustments': ( 'API/misc_tools.html#general_plot_aesthetic_adjustments',
73+
'dabest/misc_tools.py'),
74+
'dabest.misc_tools.add_counts_to_ticks': ( 'API/misc_tools.html#add_counts_to_ticks',
75+
'dabest/misc_tools.py'),
76+
'dabest.misc_tools.extract_contrast_plotting_ticks': ( 'API/misc_tools.html#extract_contrast_plotting_ticks',
77+
'dabest/misc_tools.py'),
78+
'dabest.misc_tools.get_color_palette': ('API/misc_tools.html#get_color_palette', 'dabest/misc_tools.py'),
79+
'dabest.misc_tools.get_kwargs': ('API/misc_tools.html#get_kwargs', 'dabest/misc_tools.py'),
80+
'dabest.misc_tools.get_params': ('API/misc_tools.html#get_params', 'dabest/misc_tools.py'),
81+
'dabest.misc_tools.get_plot_groups': ('API/misc_tools.html#get_plot_groups', 'dabest/misc_tools.py'),
82+
'dabest.misc_tools.get_varname': ('API/misc_tools.html#get_varname', 'dabest/misc_tools.py'),
83+
'dabest.misc_tools.initialize_fig': ('API/misc_tools.html#initialize_fig', 'dabest/misc_tools.py'),
6984
'dabest.misc_tools.merge_two_dicts': ('API/misc_tools.html#merge_two_dicts', 'dabest/misc_tools.py'),
7085
'dabest.misc_tools.print_greeting': ('API/misc_tools.html#print_greeting', 'dabest/misc_tools.py'),
86+
'dabest.misc_tools.set_xaxis_ticks_and_lims': ( 'API/misc_tools.html#set_xaxis_ticks_and_lims',
87+
'dabest/misc_tools.py'),
88+
'dabest.misc_tools.show_legend': ('API/misc_tools.html#show_legend', 'dabest/misc_tools.py'),
7189
'dabest.misc_tools.unpack_and_add': ('API/misc_tools.html#unpack_and_add', 'dabest/misc_tools.py')},
72-
'dabest.plot_tools': { 'dabest.plot_tools.SwarmPlot': ('API/plot_tools.html#swarmplot', 'dabest/plot_tools.py'),
90+
'dabest.plot_tools': { 'dabest.plot_tools.DeltaDotsPlotter': ('API/plot_tools.html#deltadotsplotter', 'dabest/plot_tools.py'),
91+
'dabest.plot_tools.SwarmPlot': ('API/plot_tools.html#swarmplot', 'dabest/plot_tools.py'),
7392
'dabest.plot_tools.SwarmPlot.__init__': ( 'API/plot_tools.html#swarmplot.__init__',
7493
'dabest/plot_tools.py'),
7594
'dabest.plot_tools.SwarmPlot._adjust_gutter_points': ( 'API/plot_tools.html#swarmplot._adjust_gutter_points',
@@ -82,14 +101,30 @@
82101
'dabest/plot_tools.py'),
83102
'dabest.plot_tools.SwarmPlot._swarm': ('API/plot_tools.html#swarmplot._swarm', 'dabest/plot_tools.py'),
84103
'dabest.plot_tools.SwarmPlot.plot': ('API/plot_tools.html#swarmplot.plot', 'dabest/plot_tools.py'),
104+
'dabest.plot_tools.barplotter': ('API/plot_tools.html#barplotter', 'dabest/plot_tools.py'),
85105
'dabest.plot_tools.check_data_matches_labels': ( 'API/plot_tools.html#check_data_matches_labels',
86106
'dabest/plot_tools.py'),
107+
'dabest.plot_tools.contrast_bars_plotter': ( 'API/plot_tools.html#contrast_bars_plotter',
108+
'dabest/plot_tools.py'),
109+
'dabest.plot_tools.delta_text_plotter': ( 'API/plot_tools.html#delta_text_plotter',
110+
'dabest/plot_tools.py'),
111+
'dabest.plot_tools.effect_size_curve_plotter': ( 'API/plot_tools.html#effect_size_curve_plotter',
112+
'dabest/plot_tools.py'),
87113
'dabest.plot_tools.error_bar': ('API/plot_tools.html#error_bar', 'dabest/plot_tools.py'),
88114
'dabest.plot_tools.get_swarm_spans': ('API/plot_tools.html#get_swarm_spans', 'dabest/plot_tools.py'),
115+
'dabest.plot_tools.grid_key_WIP': ('API/plot_tools.html#grid_key_wip', 'dabest/plot_tools.py'),
89116
'dabest.plot_tools.halfviolin': ('API/plot_tools.html#halfviolin', 'dabest/plot_tools.py'),
90117
'dabest.plot_tools.normalize_dict': ('API/plot_tools.html#normalize_dict', 'dabest/plot_tools.py'),
118+
'dabest.plot_tools.plot_minimeta_or_deltadelta_violins': ( 'API/plot_tools.html#plot_minimeta_or_deltadelta_violins',
119+
'dabest/plot_tools.py'),
91120
'dabest.plot_tools.sankeydiag': ('API/plot_tools.html#sankeydiag', 'dabest/plot_tools.py'),
92121
'dabest.plot_tools.single_sankey': ('API/plot_tools.html#single_sankey', 'dabest/plot_tools.py'),
122+
'dabest.plot_tools.slopegraph_plotter': ( 'API/plot_tools.html#slopegraph_plotter',
123+
'dabest/plot_tools.py'),
124+
'dabest.plot_tools.summary_bars_plotter': ( 'API/plot_tools.html#summary_bars_plotter',
125+
'dabest/plot_tools.py'),
126+
'dabest.plot_tools.swarm_bars_plotter': ( 'API/plot_tools.html#swarm_bars_plotter',
127+
'dabest/plot_tools.py'),
93128
'dabest.plot_tools.swarmplot': ('API/plot_tools.html#swarmplot', 'dabest/plot_tools.py'),
94129
'dabest.plot_tools.width_determine': ('API/plot_tools.html#width_determine', 'dabest/plot_tools.py')},
95130
'dabest.plotter': {'dabest.plotter.effectsize_df_plotter': ('API/plotter.html#effectsize_df_plotter', 'dabest/plotter.py')}}}

dabest/_stats_tools/confint_1group.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""A range of functions to compute bootstraps for a single sample."""
2+
13
# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/API/confint_1group.ipynb.
24

35
# %% auto 0

dabest/_stats_tools/confint_2group_diff.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""A range of functions to compute bootstraps for the mean difference"""
2+
13
# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/API/confint_2group_diff.ipynb.
24

35
# %% auto 0

dabest/_stats_tools/effsize.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""A range of functions to compute various effect sizes."""
2+
13
# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/API/effsize.ipynb.
24

35
# %% ../../nbs/API/effsize.ipynb 4

dabest/forest_plot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Creating forest plots from contrast objects."""
2+
13
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/forest_plot.ipynb.
24

35
# %% auto 0

0 commit comments

Comments
 (0)