@@ -332,23 +332,9 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
332332 pivot_values = [yvar , color_col ]
333333 pivoted_plot_data = pd .pivot (data = plot_data , index = dabest_obj .id_col ,
334334 columns = xvar , values = pivot_values )
335- if is_paired == "baseline" :
336- temp_idx = []
337- for i in idx :
338- control = i [0 ]
339- temp_idx .extend (((control , test ) for test in i [1 :]))
340- temp_idx = tuple (temp_idx )
341-
342- temp_all_plot_groups = []
343- for i in temp_idx :
344- temp_all_plot_groups .extend (list (i ))
345- else :
346- temp_idx = idx
347- temp_all_plot_groups = all_plot_groups
348-
349335 x_start = 0
350- for ii , current_tuple in enumerate (temp_idx ):
351- if len (temp_idx ) > 1 :
336+ for ii , current_tuple in enumerate (idx ):
337+ if len (idx ) > 1 :
352338 # Select only the data for the current tuple.
353339 if color_col is None :
354340 current_pair = pivoted_plot_data .reindex (columns = current_tuple )
@@ -377,8 +363,8 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
377363 rawdata_axes .plot (x_points , y_points , ** slopegraph_kwargs )
378364 x_start = x_start + grp_count
379365 # Set the tick labels, because the slopegraph plotting doesn't.
380- rawdata_axes .set_xticks (np .arange (0 , len (temp_all_plot_groups )))
381- rawdata_axes .set_xticklabels (temp_all_plot_groups )
366+ rawdata_axes .set_xticks (np .arange (0 , len (all_plot_groups )))
367+ rawdata_axes .set_xticklabels (all_plot_groups )
382368
383369
384370 else :
@@ -445,19 +431,12 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
445431
446432 # Plot effect sizes and bootstraps.
447433 # Take note of where the `control` groups are.
448- if is_paired == "baseline" and show_pairs == True :
449- ticks_to_skip = np .arange (0 , len (temp_all_plot_groups ), 2 ).tolist ()
450- ticks_to_plot = np .arange (1 , len (temp_all_plot_groups ), 2 ).tolist ()
451- ticks_to_skip_contrast = np .cumsum ([(len (t )- 1 )* 2 for t in idx ])[:- 1 ].tolist ()
452- ticks_to_skip_contrast .insert (0 , 0 )
453-
454- else :
455- ticks_to_skip = np .cumsum ([len (t ) for t in idx ])[:- 1 ].tolist ()
456- ticks_to_skip .insert (0 , 0 )
434+ ticks_to_skip = np .cumsum ([len (t ) for t in idx ])[:- 1 ].tolist ()
435+ ticks_to_skip .insert (0 , 0 )
457436
458437 # Then obtain the ticks where we have to plot the effect sizes.
459- ticks_to_plot = [t for t in range (0 , len (all_plot_groups ))
460- if t not in ticks_to_skip ]
438+ ticks_to_plot = [t for t in range (0 , len (all_plot_groups ))
439+ if t not in ticks_to_skip ]
461440
462441
463442 # Plot the bootstraps, then the effect sizes and CIs.
@@ -704,55 +683,22 @@ def EffectSizeDataFramePlotter(EffectSizeDataFrame, **plot_kwargs):
704683 if contrast_ylim_low < 0 < contrast_ylim_high :
705684 contrast_axes .axhline (y = 0 , ** reflines_kwargs )
706685
707- if is_paired == "baseline" and show_pairs == True :
708- rightend_ticks_raw = np .array ([len (i )- 1 for i in temp_idx ]) + np .array (ticks_to_skip )
709- for ax in [rawdata_axes ]:
710- sns .despine (ax = ax , bottom = True )
711-
712- ylim = ax .get_ylim ()
713- xlim = ax .get_xlim ()
714- redraw_axes_kwargs ['y' ] = ylim [0 ]
715-
716- for k , start_tick in enumerate (ticks_to_skip ):
717- end_tick = rightend_ticks_raw [k ]
718- ax .hlines (xmin = start_tick , xmax = end_tick ,
719- ** redraw_axes_kwargs )
720-
721- ax .set_ylim (ylim )
722- del redraw_axes_kwargs ['y' ]
723-
724- rightend_ticks_contrast = np .array ([(len (i )- 1 )* 2 - 1 for i in idx ]) + np .array (ticks_to_skip_contrast )
725- for ax in [contrast_axes ]:
726- sns .despine (ax = ax , bottom = True )
727-
728- ylim = ax .get_ylim ()
729- xlim = ax .get_xlim ()
730- redraw_axes_kwargs ['y' ] = ylim [0 ]
731-
732- for k , start_tick in enumerate (ticks_to_skip_contrast ):
733- end_tick = rightend_ticks_contrast [k ]
734- ax .hlines (xmin = start_tick , xmax = end_tick ,
735- ** redraw_axes_kwargs )
736-
737- ax .set_ylim (ylim )
738- del redraw_axes_kwargs ['y' ]
739- else :
740- # Compute the end of each x-axes line.
741- rightend_ticks = np .array ([len (i )- 1 for i in idx ]) + np .array (ticks_to_skip )
742- for ax in [rawdata_axes , contrast_axes ]:
743- sns .despine (ax = ax , bottom = True )
744-
745- ylim = ax .get_ylim ()
746- xlim = ax .get_xlim ()
747- redraw_axes_kwargs ['y' ] = ylim [0 ]
686+ # Compute the end of each x-axes line.
687+ rightend_ticks = np .array ([len (i )- 1 for i in idx ]) + np .array (ticks_to_skip )
688+ for ax in [rawdata_axes , contrast_axes ]:
689+ sns .despine (ax = ax , bottom = True )
690+
691+ ylim = ax .get_ylim ()
692+ xlim = ax .get_xlim ()
693+ redraw_axes_kwargs ['y' ] = ylim [0 ]
748694
749- for k , start_tick in enumerate (ticks_to_skip ):
750- end_tick = rightend_ticks [k ]
751- ax .hlines (xmin = start_tick , xmax = end_tick ,
752- ** redraw_axes_kwargs )
695+ for k , start_tick in enumerate (ticks_to_skip ):
696+ end_tick = rightend_ticks [k ]
697+ ax .hlines (xmin = start_tick , xmax = end_tick ,
698+ ** redraw_axes_kwargs )
753699
754- ax .set_ylim (ylim )
755- del redraw_axes_kwargs ['y' ]
700+ ax .set_ylim (ylim )
701+ del redraw_axes_kwargs ['y' ]
756702
757703
758704
0 commit comments