|
432 | 432 | "\n", |
433 | 433 | " # Table axes for horizontal plot kwargs.\n", |
434 | 434 | " default_table_kwargs = {\n", |
| 435 | + " 'show': True,\n", |
435 | 436 | " 'color' : 'yellow',\n", |
436 | 437 | " 'alpha' :0.2,\n", |
437 | 438 | " 'fontsize' : 12,\n", |
|
624 | 625 | " plot_palette_bar, plot_palette_contrast, plot_palette_sankey)\n", |
625 | 626 | "\n", |
626 | 627 | "def initialize_fig(plot_kwargs, dabest_obj, show_delta2, show_mini_meta, is_paired, show_pairs, proportional,\n", |
627 | | - " float_contrast, effect_size_type, yvar, horizontal):\n", |
| 628 | + " float_contrast, effect_size_type, yvar, horizontal, show_table):\n", |
628 | 629 | " \"\"\"\n", |
629 | 630 | " Initialize the figure and axes for the plotter function.\n", |
630 | 631 | "\n", |
|
652 | 653 | " The name of the y-axis variable.\n", |
653 | 654 | " horizontal : bool\n", |
654 | 655 | " A boolean flag to determine if the plot is for horizontal plotting.\n", |
655 | | - " redraw_axes_kwargs : dict\n", |
656 | | - " Kwargs for the redraw_axes.\n", |
| 656 | + " show_table : dict\n", |
| 657 | + " A boolean flag to determine if the table will be shown in horizontal plot.\n", |
657 | 658 | " \"\"\"\n", |
658 | 659 | " # Params\n", |
659 | 660 | " fig_size = plot_kwargs[\"fig_size\"]\n", |
|
708 | 709 | " contrast_axes = rawdata_axes.inset_axes(\n", |
709 | 710 | " [1+contrast_wspace, 0, (plot_width_ratios[1]/plot_width_ratios[0]), 1]\n", |
710 | 711 | " )\n", |
711 | | - " table_axes = rawdata_axes.inset_axes(\n", |
712 | | - " [1+contrast_wspace+(plot_width_ratios[1]/plot_width_ratios[0]), 0, (plot_width_ratios[2]/plot_width_ratios[0]), 1]\n", |
713 | | - " )\n", |
| 712 | + " if show_table:\n", |
| 713 | + " table_axes = rawdata_axes.inset_axes(\n", |
| 714 | + " [1+contrast_wspace+(plot_width_ratios[1]/plot_width_ratios[0]), 0, (plot_width_ratios[2]/plot_width_ratios[0]), 1]\n", |
| 715 | + " )\n", |
| 716 | + " else:\n", |
| 717 | + " table_axes = None\n", |
714 | 718 | "\n", |
715 | 719 | " rawdata_axes.set_position(\n", |
716 | 720 | " [ax_position.x0,\n", |
|
756 | 760 | " else:\n", |
757 | 761 | " # Here, we hardcode some figure parameters.\n", |
758 | 762 | " if horizontal:\n", |
759 | | - " fig, axx = plt.subplots(\n", |
760 | | - " ncols=3, gridspec_kw={'width_ratios' : [1,0.7,0.3], 'wspace' : 0.05}, **init_fig_kwargs\n", |
761 | | - " )\n", |
762 | | - " fig.patch.set_facecolor(face_color)\n", |
763 | | - "\n", |
| 763 | + " if show_table:\n", |
| 764 | + " fig, axx = plt.subplots(\n", |
| 765 | + " ncols=3, gridspec_kw={'width_ratios' : [1,0.7,0.3], 'wspace' : 0.05}, **init_fig_kwargs\n", |
| 766 | + " )\n", |
| 767 | + " else:\n", |
| 768 | + " fig, axx = plt.subplots(\n", |
| 769 | + " ncols=2, gridspec_kw={'width_ratios' : [1,0.7], 'wspace' : 0.05}, **init_fig_kwargs\n", |
| 770 | + " )\n", |
764 | 771 | " else:\n", |
765 | 772 | " if float_contrast:\n", |
766 | 773 | " fig, axx = plt.subplots(\n", |
767 | 774 | " ncols=2,\n", |
768 | 775 | " gridspec_kw={\"width_ratios\": width_ratios_ga, \"wspace\": 0},\n", |
769 | 776 | " **init_fig_kwargs\n", |
770 | 777 | " )\n", |
771 | | - " fig.patch.set_facecolor(face_color)\n", |
772 | | - "\n", |
773 | 778 | " else:\n", |
774 | 779 | " fig, axx = plt.subplots(\n", |
775 | 780 | " nrows=2, gridspec_kw={\"hspace\": h_space_cummings}, **init_fig_kwargs\n", |
776 | 781 | " )\n", |
777 | | - " fig.patch.set_facecolor(face_color)\n", |
| 782 | + " fig.patch.set_facecolor(face_color)\n", |
778 | 783 | "\n", |
779 | 784 | " # Title\n", |
780 | 785 | " title = plot_kwargs[\"title\"]\n", |
|
783 | 788 | " fig.suptitle(title, fontsize=fontsize_title)\n", |
784 | 789 | " rawdata_axes = axx[0]\n", |
785 | 790 | " contrast_axes = axx[1]\n", |
786 | | - " table_axes = axx[2] if horizontal else None\n", |
| 791 | + " table_axes = axx[2] if horizontal and show_table else None\n", |
787 | 792 | " rawdata_axes.set_frame_on(False)\n", |
788 | 793 | " contrast_axes.set_frame_on(False)\n", |
789 | | - " if horizontal:\n", |
| 794 | + " if horizontal and show_table:\n", |
790 | 795 | " table_axes.set_frame_on(False)\n", |
791 | 796 | " \n", |
792 | 797 | " # Swarmplot ylim (Vertical) or xlim (Horizontal)\n", |
|
0 commit comments