|
113 | 113 | " fontsize_contrastxlabel=12, fontsize_contrastylabel=12,\n", |
114 | 114 | " fontsize_delta2label=12\n", |
115 | 115 | " \"\"\"\n", |
116 | | - " from .misc_tools import merge_two_dicts\n", |
| 116 | + " from .misc_tools import merge_two_dicts, get_unique_categories\n", |
117 | 117 | " from .plot_tools import (\n", |
118 | 118 | " halfviolin,\n", |
119 | 119 | " get_swarm_spans,\n", |
|
357 | 357 | " raise ValueError(err1 + err2)\n", |
358 | 358 | "\n", |
359 | 359 | " if custom_pal is None and color_col is None:\n", |
| 360 | + " categories = get_unique_categories(names)\n", |
| 361 | + " \n", |
360 | 362 | " swarm_colors = [sns.desaturate(c, swarm_desat) for c in unsat_colors]\n", |
361 | | - " plot_palette_raw = dict(zip(names.categories, swarm_colors))\n", |
362 | | - "\n", |
363 | 363 | " bar_color = [sns.desaturate(c, bar_desat) for c in unsat_colors]\n", |
364 | | - " plot_palette_bar = dict(zip(names.categories, bar_color))\n", |
365 | | - "\n", |
366 | 364 | " contrast_colors = [sns.desaturate(c, contrast_desat) for c in unsat_colors]\n", |
367 | | - " plot_palette_contrast = dict(zip(names.categories, contrast_colors))\n", |
| 365 | + "\n", |
| 366 | + " \n", |
| 367 | + " plot_palette_raw = dict(zip(categories, swarm_colors))\n", |
| 368 | + " plot_palette_bar = dict(zip(categories, bar_color))\n", |
| 369 | + " plot_palette_contrast = dict(zip(categories, contrast_colors))\n", |
368 | 370 | "\n", |
369 | 371 | " # For Sankey Diagram plot, no need to worry about the color, each bar will have the same two colors\n", |
370 | 372 | " # default color palette will be set to \"hls\"\n", |
|
1140 | 1142 | " )\n", |
1141 | 1143 | " elif effect_size_type == \"median_diff\":\n", |
1142 | 1144 | " control_group_summary = (\n", |
1143 | | - " plot_data.groupby(xvar).median().loc[current_control, yvar]\n", |
| 1145 | + " plot_data.groupby(xvar).median(numeric_only=True).loc[current_control, yvar]\n", |
1144 | 1146 | " )\n", |
1145 | 1147 | " test_group_summary = (\n", |
1146 | | - " plot_data.groupby(xvar).median().loc[current_group, yvar]\n", |
| 1148 | + " plot_data.groupby(xvar).median(numeric_only=True).loc[current_group, yvar]\n", |
1147 | 1149 | " )\n", |
1148 | 1150 | "\n", |
1149 | 1151 | " if swarm_ylim is None:\n", |
|
0 commit comments