Forest plot

Creating forest plots from contrast objects.

source

forest_plot

 forest_plot (data:list, idx:Optional[list[int]]=None,
              ax:Optional[matplotlib.axes._axes.Axes]=None,
              fig_size:tuple[int,int]=None, effect_size:str='mean_diff',
              ci_type='bca', horizontal:bool=False, marker_size:int=10,
              custom_palette:Union[dict,list,str,NoneType]=None,
              contrast_alpha:float=0.8, contrast_desat:float=1,
              labels:list[str]=None, labels_rotation:int=None,
              labels_fontsize:int=10, title:str=None,
              title_fontsize:int=16, ylabel:str=None,
              ylabel_fontsize:int=12,
              ylim:Optional[list[float,float]]=None,
              yticks:Optional[list[float]]=None,
              yticklabels:Optional[list[str]]=None,
              remove_spines:bool=True, delta_text:bool=True,
              delta_text_kwargs:dict=None, contrast_bars:bool=True,
              contrast_bars_kwargs:dict=None,
              reference_band:list|tuple=None,
              reference_band_kwargs:dict=None,
              violin_kwargs:Optional[dict]=None,
              zeroline_kwargs:Optional[dict]=None,
              marker_kwargs:Optional[dict]=None,
              errorbar_kwargs:Optional[dict]=None)

Custom function that generates a forest plot from given contrast objects, suitable for a range of data analysis types, including those from packages like DABEST-python.

Type Default Details
data list List of contrast objects.
idx Optional None List of indices to select from the contrast objects if delta-delta experiment.
If None, only the delta-delta objects are plotted.
ax Optional None Matplotlib Axes object for the plot; creates new if None.
additional_plotting_kwargs : Optional[dict], default=None
Further customization arguments for the plot.
fig_size tuple None Figure size for the plot.
effect_size str mean_diff Type of effect size to plot (e.g., ‘mean_diff’, hedges_g or ‘delta_g’).
ci_type str bca Type of confidence interval to plot (bca’ or ‘pct’)
horizontal bool False If True, the plot will be horizontal.
marker_size int 10 Marker size for plotting effect size dots.
custom_palette Union None Custom color palette for the plot.
contrast_alpha float 0.8 Transparency level for violin plots.
contrast_desat float 1 Saturation level for violin plots.
labels list None Labels for each contrast. If None, defaults to ‘Contrast 1’, ‘Contrast 2’, etc.
labels_rotation int None Rotation angle for contrast labels.
labels_fontsize int 10 Font size for contrast labels.
title str None Plot title, summarizing the visualized data.
title_fontsize int 16 Font size for the plot title.
ylabel str None Label for the y-axis, describing the plotted data or effect size.
ylabel_fontsize int 12 Font size for the y-axis label.
ylim Optional None Limits for the y-axis.
yticks Optional None Custom y-ticks for the plot.
yticklabels Optional None Custom y-tick labels for the plot.
remove_spines bool True If True, removes plot spines (except the relevant dependent variable spine).
delta_text bool True If True, it adds text next to each curve representing the effect size value.
delta_text_kwargs dict None Additional keyword arguments for the delta_text.
contrast_bars bool True If True, it adds bars from the zeroline to the effect size curve.
contrast_bars_kwargs dict None Additional keyword arguments for the contrast_bars.
reference_band list | tuple None
reference_band_kwargs dict None Additional keyword arguments for the reference_band.
violin_kwargs Optional None Additional arguments for violin plot customization.
zeroline_kwargs Optional None Additional arguments for the zero line customization.
marker_kwargs Optional None Additional arguments for the effect size marker customization.
errorbar_kwargs Optional None Additional arguments for the effect size error bar customization.
Returns Figure The matplotlib figure object with the generated forest plot.

source

color_palette

 color_palette (custom_palette, labels, number_of_curves_to_plot,
                contrast_desat)

source

get_kwargs

 get_kwargs (violin_kwargs, zeroline_kwargs, horizontal, marker_kwargs,
             errorbar_kwargs, delta_text_kwargs, contrast_bars_kwargs,
             reference_band_kwargs, marker_size)

source

check_for_errors

 check_for_errors (**kwargs)

source

load_plot_data

 load_plot_data (data:List, effect_size:str='mean_diff',
                 contrast_type:str=None, ci_type:str='bca',
                 idx:Optional[List[int]]=None)

Loads plot data based on specified effect size and contrast type.

Type Default Details
data List
effect_size str mean_diff
contrast_type str None
ci_type str bca
idx Optional None
Returns List