Forest plot

Creating forest plots from contrast objects.

source

forest_plot


def forest_plot(
    data:list, # List of contrast objects.
    idx:Optional[list[int]]=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[plt.Axes]=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[int, int]=None, # Figure size for the plot.
    effect_size:str='mean_diff', # Type of effect size to plot (e.g., 'mean_diff', [`hedges_g`](https://acclab.github.io/DABEST-python/API/effsize.html#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:Optional[Union[dict, list, str]]=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[str]=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[list[float, float]]=None, # Limits for the y-axis.
    yticks:Optional[list[float]]=None, # Custom y-ticks for the plot.
    yticklabels:Optional[list[str]]=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[dict]=None, # Additional arguments for violin plot customization.
    zeroline_kwargs:Optional[dict]=None, # Additional arguments for the zero line customization.
    marker_kwargs:Optional[dict]=None, # Additional arguments for the effect size marker customization.
    errorbar_kwargs:Optional[dict]=None, # Additional arguments for the effect size error bar customization.
)->plt.Figure: # The matplotlib figure object with the generated forest plot.

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.


source

color_palette


def color_palette(
    custom_palette, labels, number_of_curves_to_plot, contrast_desat
):

Call self as a function.


source

get_kwargs


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

Call self as a function.


source

check_for_errors


def check_for_errors(
    kwargs:VAR_KEYWORD
):

Call self as a function.


source

load_plot_data


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

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