|
1066 | 1066 | " )\n", |
1067 | 1067 | " contrast_bars_kwargs.pop('color')\n", |
1068 | 1068 | "\n", |
1069 | | - " if horizontal:\n", |
1070 | | - " for contrast_bars_x,contrast_bars_y in zip(ticks_to_plot, contrast_means):\n", |
1071 | | - " idx_selector = (\n", |
1072 | | - " int(contrast_bars_x) \n", |
1073 | | - " if type(contrast_bars_colors) == list \n", |
1074 | | - " else unpacked_idx[int(contrast_bars_x)]\n", |
1075 | | - " )\n", |
1076 | | - " ax_to_plot.add_patch(mpatches.Rectangle((0,contrast_bars_x-0.5),contrast_bars_y, 0.5, color=contrast_bars_colors[idx_selector], **contrast_bars_kwargs))\n", |
| 1069 | + " for contrast_bars_x,contrast_bars_y in zip(ticks_to_plot, contrast_means):\n", |
| 1070 | + " idx_selector = (\n", |
| 1071 | + " int(contrast_bars_x) \n", |
| 1072 | + " if type(contrast_bars_colors) == list \n", |
| 1073 | + " else unpacked_idx[int(contrast_bars_x)]\n", |
| 1074 | + " )\n", |
| 1075 | + " if horizontal:\n", |
| 1076 | + " ax_to_plot.add_patch(mpatches.Rectangle((0, contrast_bars_x-0.5), contrast_bars_y, 0.5, color=contrast_bars_colors[idx_selector], **contrast_bars_kwargs))\n", |
| 1077 | + " else:\n", |
| 1078 | + " ax_to_plot.add_patch(mpatches.Rectangle((contrast_bars_x-0.25, 0),0.5, contrast_bars_y, color=contrast_bars_colors[idx_selector], **contrast_bars_kwargs))\n", |
1077 | 1079 | "\n", |
1078 | | - " if show_mini_meta or show_delta2:\n", |
1079 | | - " diff = mini_meta_delta.difference if show_mini_meta else delta_delta.difference\n", |
| 1080 | + " if show_mini_meta or show_delta2:\n", |
| 1081 | + " diff = mini_meta_delta.difference if show_mini_meta else delta_delta.difference\n", |
| 1082 | + " if horizontal:\n", |
1080 | 1083 | " 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", |
1081 | | - "\n", |
1082 | | - " else:\n", |
1083 | | - " for contrast_bars_x,contrast_bars_y in zip(ticks_to_plot, contrast_means):\n", |
1084 | | - " idx_selector = (\n", |
1085 | | - " int(contrast_bars_x) \n", |
1086 | | - " if type(contrast_bars_colors) == list \n", |
1087 | | - " else unpacked_idx[int(contrast_bars_x)]\n", |
1088 | | - " )\n", |
1089 | | - " ax_to_plot.add_patch(mpatches.Rectangle((contrast_bars_x-0.25,0),0.5, contrast_bars_y, color=contrast_bars_colors[idx_selector], **contrast_bars_kwargs))\n", |
1090 | | - "\n", |
1091 | | - " if show_mini_meta or show_delta2:\n", |
1092 | | - " diff = mini_meta_delta.difference if show_mini_meta else delta_delta.difference\n", |
| 1084 | + " else:\n", |
1093 | 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", |
1094 | 1086 | "\n", |
1095 | 1087 | " ax_to_plot.set_xlim(og_xlim)\n", |
|
1154 | 1146 | " ax.set_xlim(og_xlim)\n", |
1155 | 1147 | " ax.set_ylim(og_ylim)\n", |
1156 | 1148 | "\n", |
1157 | | - "def delta_text_plotter(results: object, ax_to_plot: object, swarm_plot_ax: object, ticks_to_plot: list, delta_text_kwargs: dict, color_col: str, \n", |
1158 | | - " plot_palette_raw: dict, is_paired: bool, proportional: bool, float_contrast: bool,\n", |
1159 | | - " show_mini_meta: bool, mini_meta_delta: object, show_delta2: bool, delta_delta: object,\n", |
1160 | | - " idx: list):\n", |
| 1149 | + "def delta_text_plotter(results: object, ax_to_plot: object, swarm_plot_ax: object, ticks_to_plot: list, delta_text_kwargs: dict, \n", |
| 1150 | + " color_col: str, plot_palette_raw: dict, is_paired: bool, proportional: bool, float_contrast: bool,\n", |
| 1151 | + " show_mini_meta: bool, mini_meta_delta: object, show_delta2: bool, delta_delta: object, idx: list):\n", |
1161 | 1152 | " \"\"\"\n", |
1162 | 1153 | " Add delta text to the contrast plot.\n", |
1163 | 1154 | "\n", |
|
1443 | 1434 | " x_start = x_start + grp_count\n", |
1444 | 1435 | "\n", |
1445 | 1436 | "def plot_minimeta_or_deltadelta_violins(show_mini_meta, effectsize_df, ci_type, rawdata_axes,\n", |
1446 | | - " contrast_axes, violinplot_kwargs, halfviolin_alpha, ytick_color, \n", |
| 1437 | + " contrast_axes, violinplot_kwargs, halfviolin_alpha, \n", |
1447 | 1438 | " contrast_xtick_labels, effect_size, show_delta2, plot_kwargs, \n", |
1448 | 1439 | " horizontal, es_marker_kwargs, es_errorbar_kwargs):\n", |
1449 | 1440 | " \"\"\"\n", |
|
1465 | 1456 | " Keyword arguments for the violinplot.\n", |
1466 | 1457 | " halfviolin_alpha : float\n", |
1467 | 1458 | " Alpha value for the half violin.\n", |
1468 | | - " ytick_color : str\n", |
1469 | | - " Color of the yticks.\n", |
1470 | 1459 | " es_marker_size : int\n", |
1471 | 1460 | " Size of the effect size marker.\n", |
1472 | 1461 | " contrast_xtick_labels : list\n", |
|
1527 | 1516 | " contrast_axes.plot(\n", |
1528 | 1517 | " effsize_x,\n", |
1529 | 1518 | " effsize_y,\n", |
1530 | | - " # color=ytick_color,\n", |
1531 | 1519 | " **es_marker_kwargs\n", |
1532 | 1520 | " )\n", |
1533 | 1521 | " # Plot the confidence interval.\n", |
1534 | 1522 | " contrast_axes.plot(\n", |
1535 | 1523 | " ci_x,\n", |
1536 | 1524 | " ci_y,\n", |
1537 | | - " # color=ytick_color,\n", |
1538 | 1525 | " **es_errorbar_kwargs\n", |
1539 | 1526 | " )\n", |
1540 | 1527 | "\n", |
|
1581 | 1568 | "\n", |
1582 | 1569 | "\n", |
1583 | 1570 | "def effect_size_curve_plotter(ticks_to_plot, results, ci_type, contrast_axes, violinplot_kwargs, halfviolin_alpha, \n", |
1584 | | - " ytick_color, bootstraps_color_by_group, plot_palette_contrast,\n", |
| 1571 | + " bootstraps_color_by_group, plot_palette_contrast,\n", |
1585 | 1572 | " horizontal, es_marker_kwargs, es_errorbar_kwargs,\n", |
1586 | 1573 | " idx, is_paired, es_paired_lines, es_paired_lines_kwargs):\n", |
1587 | 1574 | " \"\"\"\n", |
|
1601 | 1588 | " Keyword arguments for the violinplot.\n", |
1602 | 1589 | " halfviolin_alpha : float\n", |
1603 | 1590 | " Alpha value for the half violin.\n", |
1604 | | - " ytick_color : str\n", |
1605 | | - " Color of the yticks.\n", |
1606 | 1591 | " es_marker_size : int\n", |
1607 | 1592 | " Size of the effect size marker.\n", |
1608 | 1593 | " bootstraps_color_by_group : bool\n", |
|
1707 | 1692 | " else:\n", |
1708 | 1693 | " mean_diffs_for_lines.append(int(0))\n", |
1709 | 1694 | "\n", |
1710 | | - " if horizontal:\n", |
1711 | | - " contrast_axes.plot(\n", |
1712 | | - " mean_diffs_for_lines,\n", |
1713 | | - " group,\n", |
1714 | | - " **es_paired_lines_kwargs\n", |
1715 | | - " )\n", |
1716 | | - " else:\n", |
1717 | | - " contrast_axes.plot(\n", |
1718 | | - " group, \n", |
1719 | | - " mean_diffs_for_lines,\n", |
1720 | | - " **es_paired_lines_kwargs\n", |
1721 | | - " )\n", |
| 1695 | + " x_data = mean_diffs_for_lines if horizontal else group\n", |
| 1696 | + " y_data = group if horizontal else mean_diffs_for_lines\n", |
| 1697 | + "\n", |
| 1698 | + " contrast_axes.plot(\n", |
| 1699 | + " x_data, \n", |
| 1700 | + " y_data,\n", |
| 1701 | + " **es_paired_lines_kwargs\n", |
| 1702 | + " )\n", |
1722 | 1703 | "\n", |
1723 | 1704 | " return current_group, current_control, current_effsize, contrast_xtick_labels\n", |
1724 | 1705 | "\n", |
|
0 commit comments