@@ -290,8 +290,8 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
290290
291291 # Initialise the figure.
292292 # sns.set(context="talk", style='ticks')
293- init_fig_kwargs = dict (figsize = fig_size , dpi = plot_kwargs ["dpi" ])
294- # ,tight_layout=True)
293+ init_fig_kwargs = dict (figsize = fig_size , dpi = plot_kwargs ["dpi" ]
294+ ,tight_layout = True )
295295
296296 width_ratios_ga = [2.5 , 1 ]
297297 h_space_cummings = 0.3
@@ -365,7 +365,7 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
365365 contrast_axes = axx [1 ]
366366 rawdata_axes .set_frame_on (False )
367367 contrast_axes .set_frame_on (False )
368- fig .set_tight_layout (False )
368+ # fig.set_tight_layout(False)
369369
370370 redraw_axes_kwargs = {'colors' : ytick_color ,
371371 'facecolors' : ytick_color ,
@@ -484,9 +484,7 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
484484 ** swarmplot_kwargs )
485485 else :
486486 # Plot the raw data as a barplot.
487- df_new = plot_data .copy ()
488- bar1_df = df_new .groupby (xvar ).count ().reset_index ()
489- bar1_df ['proportion' ] = [i / j for i , j in zip (bar1_df [yvar ], bar1_df [yvar ])]
487+ bar1_df = pd .DataFrame ({xvar : all_plot_groups , 'proportion' : np .ones (len (all_plot_groups ))})
490488 bar1 = sns .barplot (data = bar1_df , x = xvar , y = "proportion" ,
491489 ax = rawdata_axes ,
492490 order = all_plot_groups ,
@@ -780,9 +778,9 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
780778 # Check that the effect size is within the swarm ylims.
781779 if effect_size_type in ["mean_diff" , "cohens_d" , "hedges_g" ,"cohens_h" ]:
782780 control_group_summary = plot_data .groupby (xvar )\
783- .mean ().loc [current_control , yvar ]
781+ .mean (numeric_only = True ).loc [current_control , yvar ]
784782 test_group_summary = plot_data .groupby (xvar )\
785- .mean ().loc [current_group , yvar ]
783+ .mean (numeric_only = True ).loc [current_group , yvar ]
786784 elif effect_size_type == "median_diff" :
787785 control_group_summary = plot_data .groupby (xvar )\
788786 .median ().loc [current_control , yvar ]
0 commit comments