Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added empty_circle plot aesthetic #174

Merged
merged 23 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c764dce
Updated empty_circle to allow color_col to be adjusted for deltadelta
sunroofgod Feb 24, 2024
7c84ae3
Added empty_circle as a plot_kwarg for plotting
sunroofgod Feb 24, 2024
458c3aa
Updated formatting
sunroofgod Feb 25, 2024
e2da55d
Added input parameter validation for new filled parameter
sunroofgod Mar 17, 2024
0e79e1c
Added unit tests for new filled parameter for swarmplot
sunroofgod Mar 17, 2024
397faac
Added baseline images for empty_circle plot aesthetic
sunroofgod Mar 17, 2024
a359186
Added baseline image tests for empty_circle plot aesthetic
sunroofgod Mar 17, 2024
6cc19f8
Updated summary lines for swarm_side='right'
sunroofgod Mar 17, 2024
508bd49
Updated summary lines for swarm_side='right'
sunroofgod Mar 17, 2024
c71a4ee
Resolve merge conflicts wrt asymmetric swarmplots and vnbdev branch
sunroofgod Mar 19, 2024
319f513
Fixed bug involving empty_circle filled dots feature not working as i…
sunroofgod Mar 22, 2024
8e63177
Merge pull request #176 from ACCLAB/v2024.03.29
Jacobluke- Mar 22, 2024
085a006
Merge pull request #177 from ACCLAB/v2024.03.29
Jacobluke- Mar 22, 2024
97585d1
Merge pull request #178 from ACCLAB/v2024.03.29
Jacobluke- Mar 22, 2024
ff3a06f
Updated swarmplot to produce legends if plotting by hue column
sunroofgod Mar 24, 2024
9f33da3
Updated errorbar handling of xspans to properly account for when hue …
sunroofgod Mar 24, 2024
8edb941
Updated errorbar handling of xspans to properly account for when hue …
sunroofgod Mar 24, 2024
4b928b7
Updated swarmplot to produce legends if plotting by hue column
sunroofgod Mar 24, 2024
d712e8e
Fix non-string input issue
Jacobluke- Mar 25, 2024
e5b26a1
Fix an error causing xtick label wrong
Jacobluke- Mar 25, 2024
001fa49
Merge remote-tracking branch 'upstream/master' into feat-asymmetric-s…
Jacobluke- Sep 20, 2024
df50e25
Resolve conflicts for empty_circle and Seaborn params
Jacobluke- Sep 23, 2024
533797c
Regenerate test image baseline
Jacobluke- Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ _proc/
.gitattributes
.last_checked
.gitconfig
.cursorignore
*.bak
*.log
*~
Expand Down
2 changes: 2 additions & 0 deletions dabest/_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Loading data and relevant groups"""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/load.ipynb.

# %% auto 0
Expand Down
2 changes: 2 additions & 0 deletions dabest/_dabest_object.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Main class for estimating statistics and generating plots."""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/dabest_object.ipynb.

# %% auto 0
Expand Down
2 changes: 2 additions & 0 deletions dabest/_delta_objects.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Auxiliary delta classes for estimating statistics and generating plots."""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/delta_objects.ipynb.

# %% auto 0
Expand Down
60 changes: 54 additions & 6 deletions dabest/_effsize_objects.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""The auxiliary classes involved in the computations of bootstrapped effect sizes."""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/effsize_objects.ipynb.

# %% auto 0
Expand Down Expand Up @@ -971,6 +973,7 @@ def plot(
contrast_ylim=None,
delta2_ylim=None,
swarm_side=None,
empty_circle=False,
custom_palette=None,
swarm_desat=0.5,
halfviolin_desat=1,
Expand All @@ -994,10 +997,6 @@ def plot(
fig_size=None,
dpi=100,
ax=None,
contrast_show_es=False,
es_sf=2,
es_fontsize=10,
contrast_show_deltas=True,
gridkey_rows=None,
gridkey_merge_pairs=False,
gridkey_show_Ns=True,
Expand All @@ -1017,6 +1016,17 @@ def plot(
fontsize_contrastxlabel=12,
fontsize_contrastylabel=12,
fontsize_delta2label=12,
#### Contrast bars and delta text and delta dots WIP ####
contrast_bars=True,
swarm_bars=True,
contrast_bars_kwargs=None,
swarm_bars_kwargs=None,
summary_bars=None,
summary_bars_kwargs=None,
delta_text=True,
delta_text_kwargs=None,
delta_dot=True,
delta_dot_kwargs=None,
):
"""
Creates an estimation plot for the effect size of interest.
Expand Down Expand Up @@ -1064,6 +1074,12 @@ def plot(
https://seaborn.pydata.org/generated/seaborn.cubehelix_palette.html
The named colors of matplotlib can be found here:
https://matplotlib.org/examples/color/named_colors.html
swarm_side: string, default None
The side on which points are swarmed for swarmplots ("center", "left", or "right").
empty_circle: boolean, default False
Boolean value determining if empty circles will be used for plotting of
swarmplot for control groups. Color of each individual swarm is also now
dependent on the comparison group.
swarm_desat : float, default 1
Decreases the saturation of the colors in the swarmplot by the
desired proportion. Uses `seaborn.desaturate()` to acheive this.
Expand Down Expand Up @@ -1159,7 +1175,39 @@ def plot(
Font size for the contrast axes ylabel.
fontsize_delta2label : float, default 12
Font size for the delta-delta axes ylabel.



contrast_bars : boolean, default True
Whether or not to display the contrast bars.
swarm_bars : boolean, default True
Whether or not to display the swarm bars.
contrast_bars_kwargs : dict, default None
Pass relevant keyword arguments to the contrast bars. Pass any keyword arguments accepted by
matplotlib.patches.Rectangle here, as a string. If None, the following keywords are passed:
{"color": None, "alpha": 0.3}
swarm_bars_kwargs : dict, default None
Pass relevant keyword arguments to the swarm bars. Pass any keyword arguments accepted by
matplotlib.patches.Rectangle here, as a string. If None, the following keywords are passed:
{"color": None, "alpha": 0.3}

summary_bars : list, default None
Pass a list of indices of the contrast objects to have summary bars displayed on the plot.
For example, [0,1] will show summary bars for the first two contrast objects.
summary_bars_kwargs: dict, default None
If None, the following keywords are passed: {"color": None, "alpha": 0.15}
delta_text : boolean, default True
Whether or not to display the text deltas.
delta_text_kwargs : dict, default None
Pass relevant keyword arguments to the delta text. Pass any keyword arguments accepted by
matplotlib.text.Text here, as a string. If None, the following keywords are passed:
{"color": None, "alpha": 1, "fontsize": 10, "ha": 'center', "va": 'center', "rotation": 0,
"x_location": 'right', "x_coordinates": None, "y_coordinates": None}
Use "x_coordinates" and "y_coordinates" if you would like to specify the text locations manually.
delta_dot : boolean, default True
Whether or not to display the delta dots on paired or repeated measure plots.
delta_dot_kwargs : dict, default None
Pass relevant keyword arguments. If None, the following keywords are passed:
{"marker": "^", "alpha": 0.5, "zorder": 2, "size": 3, "side": "right"}

Returns
-------
Expand All @@ -1180,7 +1228,7 @@ def plot(
if hasattr(self, "results") is False:
self.__pre_calc()

if self.__delta2:
if self.__delta2 and not empty_circle:
color_col = self.__x2

# if self.__proportional:
Expand Down
39 changes: 37 additions & 2 deletions dabest/_modidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,30 @@
'dabest/forest_plot.py'),
'dabest.forest_plot.forest_plot': ('API/forest_plot.html#forest_plot', 'dabest/forest_plot.py'),
'dabest.forest_plot.load_plot_data': ('API/forest_plot.html#load_plot_data', 'dabest/forest_plot.py')},
'dabest.misc_tools': { 'dabest.misc_tools.get_varname': ('API/misc_tools.html#get_varname', 'dabest/misc_tools.py'),
'dabest.misc_tools': { 'dabest.misc_tools.Cumming_Plot_Aesthetic_Adjustments': ( 'API/misc_tools.html#cumming_plot_aesthetic_adjustments',
'dabest/misc_tools.py'),
'dabest.misc_tools.Gardner_Altman_Plot_Aesthetic_Adjustments': ( 'API/misc_tools.html#gardner_altman_plot_aesthetic_adjustments',
'dabest/misc_tools.py'),
'dabest.misc_tools.General_Plot_Aesthetic_Adjustments': ( 'API/misc_tools.html#general_plot_aesthetic_adjustments',
'dabest/misc_tools.py'),
'dabest.misc_tools.add_counts_to_ticks': ( 'API/misc_tools.html#add_counts_to_ticks',
'dabest/misc_tools.py'),
'dabest.misc_tools.extract_contrast_plotting_ticks': ( 'API/misc_tools.html#extract_contrast_plotting_ticks',
'dabest/misc_tools.py'),
'dabest.misc_tools.get_color_palette': ('API/misc_tools.html#get_color_palette', 'dabest/misc_tools.py'),
'dabest.misc_tools.get_kwargs': ('API/misc_tools.html#get_kwargs', 'dabest/misc_tools.py'),
'dabest.misc_tools.get_params': ('API/misc_tools.html#get_params', 'dabest/misc_tools.py'),
'dabest.misc_tools.get_plot_groups': ('API/misc_tools.html#get_plot_groups', 'dabest/misc_tools.py'),
'dabest.misc_tools.get_varname': ('API/misc_tools.html#get_varname', 'dabest/misc_tools.py'),
'dabest.misc_tools.initialize_fig': ('API/misc_tools.html#initialize_fig', 'dabest/misc_tools.py'),
'dabest.misc_tools.merge_two_dicts': ('API/misc_tools.html#merge_two_dicts', 'dabest/misc_tools.py'),
'dabest.misc_tools.print_greeting': ('API/misc_tools.html#print_greeting', 'dabest/misc_tools.py'),
'dabest.misc_tools.set_xaxis_ticks_and_lims': ( 'API/misc_tools.html#set_xaxis_ticks_and_lims',
'dabest/misc_tools.py'),
'dabest.misc_tools.show_legend': ('API/misc_tools.html#show_legend', 'dabest/misc_tools.py'),
'dabest.misc_tools.unpack_and_add': ('API/misc_tools.html#unpack_and_add', 'dabest/misc_tools.py')},
'dabest.plot_tools': { 'dabest.plot_tools.SwarmPlot': ('API/plot_tools.html#swarmplot', 'dabest/plot_tools.py'),
'dabest.plot_tools': { 'dabest.plot_tools.DeltaDotsPlotter': ('API/plot_tools.html#deltadotsplotter', 'dabest/plot_tools.py'),
'dabest.plot_tools.SwarmPlot': ('API/plot_tools.html#swarmplot', 'dabest/plot_tools.py'),
'dabest.plot_tools.SwarmPlot.__init__': ( 'API/plot_tools.html#swarmplot.__init__',
'dabest/plot_tools.py'),
'dabest.plot_tools.SwarmPlot._adjust_gutter_points': ( 'API/plot_tools.html#swarmplot._adjust_gutter_points',
Expand All @@ -82,14 +101,30 @@
'dabest/plot_tools.py'),
'dabest.plot_tools.SwarmPlot._swarm': ('API/plot_tools.html#swarmplot._swarm', 'dabest/plot_tools.py'),
'dabest.plot_tools.SwarmPlot.plot': ('API/plot_tools.html#swarmplot.plot', 'dabest/plot_tools.py'),
'dabest.plot_tools.barplotter': ('API/plot_tools.html#barplotter', 'dabest/plot_tools.py'),
'dabest.plot_tools.check_data_matches_labels': ( 'API/plot_tools.html#check_data_matches_labels',
'dabest/plot_tools.py'),
'dabest.plot_tools.contrast_bars_plotter': ( 'API/plot_tools.html#contrast_bars_plotter',
'dabest/plot_tools.py'),
'dabest.plot_tools.delta_text_plotter': ( 'API/plot_tools.html#delta_text_plotter',
'dabest/plot_tools.py'),
'dabest.plot_tools.effect_size_curve_plotter': ( 'API/plot_tools.html#effect_size_curve_plotter',
'dabest/plot_tools.py'),
'dabest.plot_tools.error_bar': ('API/plot_tools.html#error_bar', 'dabest/plot_tools.py'),
'dabest.plot_tools.get_swarm_spans': ('API/plot_tools.html#get_swarm_spans', 'dabest/plot_tools.py'),
'dabest.plot_tools.grid_key_WIP': ('API/plot_tools.html#grid_key_wip', 'dabest/plot_tools.py'),
'dabest.plot_tools.halfviolin': ('API/plot_tools.html#halfviolin', 'dabest/plot_tools.py'),
'dabest.plot_tools.normalize_dict': ('API/plot_tools.html#normalize_dict', 'dabest/plot_tools.py'),
'dabest.plot_tools.plot_minimeta_or_deltadelta_violins': ( 'API/plot_tools.html#plot_minimeta_or_deltadelta_violins',
'dabest/plot_tools.py'),
'dabest.plot_tools.sankeydiag': ('API/plot_tools.html#sankeydiag', 'dabest/plot_tools.py'),
'dabest.plot_tools.single_sankey': ('API/plot_tools.html#single_sankey', 'dabest/plot_tools.py'),
'dabest.plot_tools.slopegraph_plotter': ( 'API/plot_tools.html#slopegraph_plotter',
'dabest/plot_tools.py'),
'dabest.plot_tools.summary_bars_plotter': ( 'API/plot_tools.html#summary_bars_plotter',
'dabest/plot_tools.py'),
'dabest.plot_tools.swarm_bars_plotter': ( 'API/plot_tools.html#swarm_bars_plotter',
'dabest/plot_tools.py'),
'dabest.plot_tools.swarmplot': ('API/plot_tools.html#swarmplot', 'dabest/plot_tools.py'),
'dabest.plot_tools.width_determine': ('API/plot_tools.html#width_determine', 'dabest/plot_tools.py')},
'dabest.plotter': {'dabest.plotter.effectsize_df_plotter': ('API/plotter.html#effectsize_df_plotter', 'dabest/plotter.py')}}}
2 changes: 2 additions & 0 deletions dabest/_stats_tools/confint_1group.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""A range of functions to compute bootstraps for a single sample."""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/API/confint_1group.ipynb.

# %% auto 0
Expand Down
2 changes: 2 additions & 0 deletions dabest/_stats_tools/confint_2group_diff.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""A range of functions to compute bootstraps for the mean difference"""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/API/confint_2group_diff.ipynb.

# %% auto 0
Expand Down
2 changes: 2 additions & 0 deletions dabest/_stats_tools/effsize.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""A range of functions to compute various effect sizes."""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/API/effsize.ipynb.

# %% ../../nbs/API/effsize.ipynb 4
Expand Down
2 changes: 2 additions & 0 deletions dabest/forest_plot.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Creating forest plots from contrast objects."""

# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/forest_plot.ipynb.

# %% auto 0
Expand Down
Loading
Loading