Skip to content

Commit b2e4dab

Browse files
committed
Adjusted alpha values for swarm and contrast bars
1 parent fdcfa0c commit b2e4dab

284 files changed

Lines changed: 177 additions & 185 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.

dabest/_effsize_objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,11 +1196,11 @@ def plot(
11961196
contrast_bars_kwargs : dict, default None
11971197
Pass relevant keyword arguments to the contrast bars. Pass any keyword arguments accepted by
11981198
matplotlib.patches.Rectangle here, as a string. If None, the following keywords are passed:
1199-
{"color": None, "alpha": 0.3, "zorder":-3}
1199+
{"color": None, "zorder":-3}
12001200
swarm_bars_kwargs : dict, default None
12011201
Pass relevant keyword arguments to the swarm bars. Pass any keyword arguments accepted by
12021202
matplotlib.patches.Rectangle here, as a string. If None, the following keywords are passed:
1203-
{"color": None, "alpha": 0.3, "zorder":-3}
1203+
{"color": None, "zorder":-3}
12041204
12051205
summary_bars : list, default None
12061206
Pass a list of indices of the contrast objects to have summary bars displayed on the plot.

dabest/misc_tools.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ def get_kwargs(plot_kwargs, ytick_color):
362362
# Swarm bars kwargs.
363363
default_swarm_bars_kwargs = {
364364
"color": None,
365-
"alpha": 0.3,
366365
"zorder":-3
367366
}
368367
if plot_kwargs["swarm_bars_kwargs"] is None:
@@ -373,7 +372,6 @@ def get_kwargs(plot_kwargs, ytick_color):
373372
# Contrast bars kwargs.
374373
default_contrast_bars_kwargs = {
375374
"color": None,
376-
"alpha": 0.3,
377375
"zorder":-3
378376
}
379377
if plot_kwargs["contrast_bars_kwargs"] is None:

dabest/plot_tools.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@ def contrast_bars_plotter(results: object, ax_to_plot: object, swarm_plot_ax: o
10071007

10081008
unpacked_idx = [element for innerList in idx for element in innerList]
10091009

1010+
# Colors
10101011
contrast_bars_colors = (
10111012
[contrast_bars_kwargs.get('color')] * int(max(ticks_to_plot) + 1)
10121013
if contrast_bars_kwargs.get('color') is not None
@@ -1016,6 +1017,9 @@ def contrast_bars_plotter(results: object, ax_to_plot: object, swarm_plot_ax: o
10161017
)
10171018
contrast_bars_kwargs.pop('color')
10181019

1020+
# alpha
1021+
contrast_bars_kwargs['alpha'] = contrast_bars_kwargs.get('alpha', 0.15 if color_col is not None or is_paired else 0.25)
1022+
10191023
for contrast_bars_x,contrast_bars_y in zip(ticks_to_plot, contrast_means):
10201024
idx_selector = (
10211025
int(contrast_bars_x)
@@ -1032,7 +1036,7 @@ def contrast_bars_plotter(results: object, ax_to_plot: object, swarm_plot_ax: o
10321036
if horizontal:
10331037
ax_to_plot.add_patch(mpatches.Rectangle((0, max(swarm_plot_ax.get_yticks())-0.5), diff, 0.5, color='black', **contrast_bars_kwargs))
10341038
else:
1035-
ax_to_plot.add_patch(mpatches.Rectangle((max(swarm_plot_ax.get_xticks())+2-0.25,0),0.5, diff, color='black', **contrast_bars_kwargs))
1039+
ax_to_plot.add_patch(mpatches.Rectangle((max(swarm_plot_ax.get_xticks())+2-0.25, 0), 0.5, diff, color='black', **contrast_bars_kwargs))
10361040

10371041
ax_to_plot.set_xlim(og_xlim)
10381042
ax_to_plot.set_ylim(og_ylim)
@@ -1075,6 +1079,7 @@ def swarm_bars_plotter(plot_data: object, xvar: str, yvar: str, ax: object,
10751079

10761080
unpacked_idx = [element for innerList in idx for element in innerList]
10771081

1082+
# Colors
10781083
swarm_bars_colors = (
10791084
[swarm_bars_kwargs.get('color')] * (len(swarm_bars_order) + 1)
10801085
if swarm_bars_kwargs.get('color') is not None
@@ -1084,6 +1089,9 @@ def swarm_bars_plotter(plot_data: object, xvar: str, yvar: str, ax: object,
10841089
)
10851090
swarm_bars_kwargs.pop('color')
10861091

1092+
# alpha
1093+
swarm_bars_kwargs['alpha'] = swarm_bars_kwargs.get('alpha', 0.15 if color_col is not None or is_paired else 0.25)
1094+
10871095
for swarm_bars_x,swarm_bars_y in zip(np.arange(0,len(swarm_bars_order)+1,1), swarm_means):
10881096
idx_selector = (
10891097
swarm_bars_x

nbs/API/effsize_objects.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,11 +1355,11 @@
13551355
" contrast_bars_kwargs : dict, default None\n",
13561356
" Pass relevant keyword arguments to the contrast bars. Pass any keyword arguments accepted by \n",
13571357
" matplotlib.patches.Rectangle here, as a string. If None, the following keywords are passed:\n",
1358-
" {\"color\": None, \"alpha\": 0.3, \"zorder\":-3}\n",
1358+
" {\"color\": None, \"zorder\":-3}\n",
13591359
" swarm_bars_kwargs : dict, default None\n",
13601360
" Pass relevant keyword arguments to the swarm bars. Pass any keyword arguments accepted by \n",
13611361
" matplotlib.patches.Rectangle here, as a string. If None, the following keywords are passed:\n",
1362-
" {\"color\": None, \"alpha\": 0.3, \"zorder\":-3}\n",
1362+
" {\"color\": None, \"zorder\":-3}\n",
13631363
"\n",
13641364
" summary_bars : list, default None\n",
13651365
" Pass a list of indices of the contrast objects to have summary bars displayed on the plot.\n",

nbs/API/misc_tools.ipynb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,6 @@
415415
" # Swarm bars kwargs.\n",
416416
" default_swarm_bars_kwargs = {\n",
417417
" \"color\": None, \n",
418-
" \"alpha\": 0.3,\n",
419418
" \"zorder\":-3\n",
420419
" }\n",
421420
" if plot_kwargs[\"swarm_bars_kwargs\"] is None:\n",
@@ -426,7 +425,6 @@
426425
" # Contrast bars kwargs.\n",
427426
" default_contrast_bars_kwargs = {\n",
428427
" \"color\": None, \n",
429-
" \"alpha\": 0.3,\n",
430428
" \"zorder\":-3\n",
431429
" }\n",
432430
" if plot_kwargs[\"contrast_bars_kwargs\"] is None:\n",

nbs/API/plot_tools.ipynb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,7 @@
10571057
"\n",
10581058
" unpacked_idx = [element for innerList in idx for element in innerList] \n",
10591059
"\n",
1060+
" # Colors\n",
10601061
" contrast_bars_colors = (\n",
10611062
" [contrast_bars_kwargs.get('color')] * int(max(ticks_to_plot) + 1) \n",
10621063
" if contrast_bars_kwargs.get('color') is not None \n",
@@ -1066,6 +1067,9 @@
10661067
" )\n",
10671068
" contrast_bars_kwargs.pop('color')\n",
10681069
"\n",
1070+
" # alpha\n",
1071+
" contrast_bars_kwargs['alpha'] = contrast_bars_kwargs.get('alpha', 0.15 if color_col is not None or is_paired else 0.25)\n",
1072+
"\n",
10691073
" for contrast_bars_x,contrast_bars_y in zip(ticks_to_plot, contrast_means):\n",
10701074
" idx_selector = (\n",
10711075
" int(contrast_bars_x) \n",
@@ -1082,7 +1086,7 @@
10821086
" if horizontal:\n",
10831087
" ax_to_plot.add_patch(mpatches.Rectangle((0, max(swarm_plot_ax.get_yticks())-0.5), diff, 0.5, color='black', **contrast_bars_kwargs))\n",
10841088
" else:\n",
1085-
" ax_to_plot.add_patch(mpatches.Rectangle((max(swarm_plot_ax.get_xticks())+2-0.25,0),0.5, diff, color='black', **contrast_bars_kwargs))\n",
1089+
" ax_to_plot.add_patch(mpatches.Rectangle((max(swarm_plot_ax.get_xticks())+2-0.25, 0), 0.5, diff, color='black', **contrast_bars_kwargs))\n",
10861090
"\n",
10871091
" ax_to_plot.set_xlim(og_xlim)\n",
10881092
" ax_to_plot.set_ylim(og_ylim)\n",
@@ -1125,6 +1129,7 @@
11251129
"\n",
11261130
" unpacked_idx = [element for innerList in idx for element in innerList] \n",
11271131
"\n",
1132+
" # Colors\n",
11281133
" swarm_bars_colors = (\n",
11291134
" [swarm_bars_kwargs.get('color')] * (len(swarm_bars_order) + 1) \n",
11301135
" if swarm_bars_kwargs.get('color') is not None \n",
@@ -1134,6 +1139,9 @@
11341139
" )\n",
11351140
" swarm_bars_kwargs.pop('color')\n",
11361141
"\n",
1142+
" # alpha\n",
1143+
" swarm_bars_kwargs['alpha'] = swarm_bars_kwargs.get('alpha', 0.15 if color_col is not None or is_paired else 0.25)\n",
1144+
"\n",
11371145
" for swarm_bars_x,swarm_bars_y in zip(np.arange(0,len(swarm_bars_order)+1,1), swarm_means):\n",
11381146
" idx_selector = (\n",
11391147
" swarm_bars_x\n",
63 Bytes
73 Bytes
100 Bytes
50 Bytes

0 commit comments

Comments
 (0)