Skip to content

Commit 02140b1

Browse files
committed
minor edits to remove redundant code
1 parent bb090ae commit 02140b1

File tree

4 files changed

+24
-30
lines changed

4 files changed

+24
-30
lines changed

dabest/misc_tools.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,7 @@ def get_color_palette(plot_kwargs, plot_data, xvar, show_pairs, idx, all_plot_gr
526526
if color_by_subgroups:
527527
plot_palette_raw = dict()
528528
plot_palette_contrast = dict()
529-
# plot_palette_bar set to None because currently there is no empty_circle toggle for proportion plots
530-
plot_palette_bar = None
529+
plot_palette_bar = None # plot_palette_bar set to None because currently there is no empty_circle toggle for proportion plots
531530
for i in range(len(idx)):
532531
for names_i in idx[i]:
533532
plot_palette_raw[names_i] = swarm_colors[i]
@@ -539,8 +538,8 @@ def get_color_palette(plot_kwargs, plot_data, xvar, show_pairs, idx, all_plot_gr
539538

540539
plot_palette_sankey = custom_pal
541540

542-
return (color_col, bootstraps_color_by_group, n_groups, filled, swarm_colors, plot_palette_raw,
543-
bar_color, plot_palette_bar, plot_palette_contrast, plot_palette_sankey)
541+
return (color_col, bootstraps_color_by_group, n_groups, filled, plot_palette_raw, bar_color,
542+
plot_palette_bar, plot_palette_contrast, plot_palette_sankey)
544543

545544
def initialize_fig(plot_kwargs, dabest_obj, show_delta2, show_mini_meta, is_paired, show_pairs, proportional,
546545
float_contrast, effect_size_type, yvar, horizontal):

dabest/plotter.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,15 @@ def effectsize_df_plotter(effectsize_df, **plot_kwargs):
140140
)
141141

142142
# Extract Color palette
143-
(color_col, bootstraps_color_by_group, n_groups,
144-
filled, swarm_colors, plot_palette_raw, bar_color,
145-
plot_palette_bar, plot_palette_contrast, plot_palette_sankey) = get_color_palette(
146-
plot_kwargs=plot_kwargs,
147-
plot_data=plot_data,
148-
xvar=xvar,
149-
show_pairs=show_pairs,
150-
idx=idx,
151-
all_plot_groups=all_plot_groups
152-
)
143+
(color_col, bootstraps_color_by_group, n_groups, filled, plot_palette_raw,
144+
bar_color, plot_palette_bar, plot_palette_contrast, plot_palette_sankey) = get_color_palette(
145+
plot_kwargs=plot_kwargs,
146+
plot_data=plot_data,
147+
xvar=xvar,
148+
show_pairs=show_pairs,
149+
idx=idx,
150+
all_plot_groups=all_plot_groups
151+
)
153152

154153
# Initialise the figure.
155154
fig, rawdata_axes, contrast_axes, table_axes = initialize_fig(
@@ -248,7 +247,6 @@ def effectsize_df_plotter(effectsize_df, **plot_kwargs):
248247
y=yvar,
249248
ax=rawdata_axes,
250249
order=all_plot_groups,
251-
# hue=xvar if color_col is None else color_col,
252250
hue=color_col,
253251
palette=plot_palette_raw,
254252
zorder=1,

nbs/API/misc_tools.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,7 @@
579579
" if color_by_subgroups:\n",
580580
" plot_palette_raw = dict()\n",
581581
" plot_palette_contrast = dict()\n",
582-
" # plot_palette_bar set to None because currently there is no empty_circle toggle for proportion plots\n",
583-
" plot_palette_bar = None\n",
582+
" plot_palette_bar = None # plot_palette_bar set to None because currently there is no empty_circle toggle for proportion plots\n",
584583
" for i in range(len(idx)):\n",
585584
" for names_i in idx[i]:\n",
586585
" plot_palette_raw[names_i] = swarm_colors[i]\n",
@@ -592,8 +591,8 @@
592591
"\n",
593592
" plot_palette_sankey = custom_pal\n",
594593
"\n",
595-
" return (color_col, bootstraps_color_by_group, n_groups, filled, swarm_colors, plot_palette_raw, \n",
596-
" bar_color, plot_palette_bar, plot_palette_contrast, plot_palette_sankey)\n",
594+
" return (color_col, bootstraps_color_by_group, n_groups, filled, plot_palette_raw, bar_color, \n",
595+
" plot_palette_bar, plot_palette_contrast, plot_palette_sankey)\n",
597596
"\n",
598597
"def initialize_fig(plot_kwargs, dabest_obj, show_delta2, show_mini_meta, is_paired, show_pairs, proportional,\n",
599598
" float_contrast, effect_size_type, yvar, horizontal):\n",

nbs/API/plotter.ipynb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,15 @@
197197
" )\n",
198198
"\n",
199199
" # Extract Color palette\n",
200-
" (color_col, bootstraps_color_by_group, n_groups, \n",
201-
" filled, swarm_colors, plot_palette_raw, bar_color, \n",
202-
" plot_palette_bar, plot_palette_contrast, plot_palette_sankey) = get_color_palette(\n",
203-
" plot_kwargs=plot_kwargs, \n",
204-
" plot_data=plot_data, \n",
205-
" xvar=xvar, \n",
206-
" show_pairs=show_pairs,\n",
207-
" idx=idx,\n",
208-
" all_plot_groups=all_plot_groups\n",
209-
" )\n",
200+
" (color_col, bootstraps_color_by_group, n_groups, filled, plot_palette_raw, \n",
201+
" bar_color, plot_palette_bar, plot_palette_contrast, plot_palette_sankey) = get_color_palette(\n",
202+
" plot_kwargs=plot_kwargs, \n",
203+
" plot_data=plot_data, \n",
204+
" xvar=xvar, \n",
205+
" show_pairs=show_pairs,\n",
206+
" idx=idx,\n",
207+
" all_plot_groups=all_plot_groups\n",
208+
" )\n",
210209
"\n",
211210
" # Initialise the figure.\n",
212211
" fig, rawdata_axes, contrast_axes, table_axes = initialize_fig(\n",
@@ -305,7 +304,6 @@
305304
" y=yvar,\n",
306305
" ax=rawdata_axes,\n",
307306
" order=all_plot_groups,\n",
308-
" # hue=xvar if color_col is None else color_col,\n",
309307
" hue=color_col,\n",
310308
" palette=plot_palette_raw,\n",
311309
" zorder=1,\n",

0 commit comments

Comments
 (0)