misc_tools
prepare_bars_for_plot
prepare_bars_for_plot (bar_type, bar_kwargs, horizontal, plot_palette_raw, color_col, show_pairs, bootstraps_color_by_group, plot_data=None, xvar=None, yvar=None, results=None, ticks_to_plot=None, extra_delta=None, reference_band=None, summary_axes=None, ci_type=None)
| Type | Default | Details | |
|---|---|---|---|
| bar_type | |||
| bar_kwargs | |||
| horizontal | |||
| plot_palette_raw | |||
| color_col | |||
| show_pairs | |||
| bootstraps_color_by_group | |||
| plot_data | NoneType | None | |
| xvar | NoneType | None | |
| yvar | NoneType | None | Raw data |
| results | NoneType | None | |
| ticks_to_plot | NoneType | None | |
| extra_delta | NoneType | None | Contrast data |
| reference_band | NoneType | None | |
| summary_axes | NoneType | None | |
| ci_type | NoneType | None | Summary data |
color_picker
color_picker (color_type:str, kwargs:dict, elements:list, color_col:str, show_pairs:bool, color_palette:dict, bootstraps_color_by_group:bool)
extract_group_summaries
extract_group_summaries (proportional:bool, rawdata_axes:matplotlib.axes._axes.Axes, asymmetric_side:str, horizontal:bool, bootstraps_color_by_group:bool, plot_palette_raw:list, all_plot_groups:list, n_groups:int, color_col, ytick_color, group_summaries_kwargs:dict)
Extract the group summaries for the plotter function.
| Type | Details | |
|---|---|---|
| proportional | bool | A boolean flag to determine if the plot is for proportional data. |
| rawdata_axes | Axes | The raw data axes. |
| asymmetric_side | str | The side of the asymmetric error bars. |
| horizontal | bool | A boolean flag to determine if the plot is for horizontal plotting. |
| bootstraps_color_by_group | bool | A boolean flag to determine if the bootstraps are colored by group. |
| plot_palette_raw | list | A list of the plot palette colors. |
| all_plot_groups | list | A list of all the plot groups. |
| n_groups | int | The number of groups. |
| color_col | str | The name of the color column. |
| ytick_color | str | The color of the y-ticks. |
| group_summaries_kwargs | dict | Kwargs passed to the group summaries. |
redraw_dependent_spines
redraw_dependent_spines (rawdata_axes:matplotlib.axes._axes.Axes, contrast_axes:matplotlib.axes._axes.Axes, redraw_axes_kwargs:dict, float_contrast:bool, horizontal:bool, show_delta2:bool, delta2_axes:matplotlib.axes._axes.Axes)
Draw the dependent axis spine lines.
| Type | Details | |
|---|---|---|
| rawdata_axes | Axes | The raw data axes. |
| contrast_axes | Axes | The contrast axes. |
| redraw_axes_kwargs | dict | Kwargs passed to the redraw axes. |
| float_contrast | bool | A boolean flag to determine if the plot is GA or Cum |
| horizontal | bool | A boolean flag to determine if the plot is for horizontal plotting. |
| show_delta2 | bool | A boolean flag to determine if the plot will have a delta-delta effect size. |
| delta2_axes | Axes | The delta2 axes. |
redraw_independent_spines
redraw_independent_spines (rawdata_axes:matplotlib.axes._axes.Axes, contrast_axes:matplotlib.axes._axes.Axes, horizontal:bool, two_col_sankey:bool, ticks_to_start_twocol_sankey:list, idx:list, is_paired:str, show_pairs:bool, proportional:bool, ticks_to_skip:list, temp_idx:list, ticks_to_skip_contrast:list, redraw_axes_kwargs:dict)
Draw the independent axis spine lines.
| Type | Details | |
|---|---|---|
| rawdata_axes | Axes | The raw data axes. |
| contrast_axes | Axes | The contrast axes. |
| horizontal | bool | A boolean flag to determine if the plot is for horizontal plotting. |
| two_col_sankey | bool | A boolean flag to determine if the plot is for two-col sankey. |
| ticks_to_start_twocol_sankey | list | A list of ticks to start for sankey plot. |
| idx | list | A list of indices. |
| is_paired | str | A boolean flag to determine if the data is paired. |
| show_pairs | bool | A boolean flag to determine if pairs should be shown. |
| proportional | bool | A boolean flag to determine if the plot is proportional/binary. |
| ticks_to_skip | list | A list of ticks to be skipped in the raw data axes. |
| temp_idx | list | A temporary list of indices to be used for skipping ticks in the raw data axes. |
| ticks_to_skip_contrast | list | A list of ticks to be skipped in the contrast axes. |
| redraw_axes_kwargs | dict | Kwargs passed to the redraw axes. |
draw_zeroline
draw_zeroline (ax:matplotlib.axes._axes.Axes, horizontal:bool, reflines_kwargs:dict, extra_delta:bool)
Draw the independent axis spine lines.
| Type | Details | |
|---|---|---|
| ax | Axes | The contrast data axes. |
| horizontal | bool | A boolean flag to determine if the plot is for horizontal plotting. |
| reflines_kwargs | dict | Additional keyword arguments to be passed to the zeroline. |
| extra_delta | bool | A boolean flag to determine if the plot includes an extra delta (delta-delta or mini-meta). |
gardner_altman_adjustments
gardner_altman_adjustments (effect_size_type:str, plot_data:pandas.core.frame.DataFrame, xvar:str, yvar:str, current_control:str, current_group:str, rawdata_axes:matplotlib.axes._axes.Axes, contrast_axes:matplotlib.axes._axes.Axes, results:pandas.core.frame.DataFrame, current_effsize:float, is_paired:bool, one_sankey:bool, reflines_kwargs:dict, redraw_axes_kwargs:dict)
Aesthetic adjustments specific to Gardner-Altman plots (float_contrast=True).
| Type | Details | |
|---|---|---|
| effect_size_type | str | The type of effect size. |
| plot_data | DataFrame | A dataframe of plot data. |
| xvar | str | The name of the x-axis variable. |
| yvar | str | The name of the y-axis variable. |
| current_control | str | The name of the current control group. |
| current_group | str | The name of the current test group. |
| rawdata_axes | Axes | The raw data axes. |
| contrast_axes | Axes | The contrast axes. |
| results | DataFrame | A dataframe of the results. |
| current_effsize | float | The current effect size. |
| is_paired | bool | A boolean flag to determine if the plot is for paired data. |
| one_sankey | bool | A boolean flag to determine if the plot is for a single sankey diagram. |
| reflines_kwargs | dict | Kwargs passed to the reference lines. |
| redraw_axes_kwargs | dict | Kwargs passed to the redraw axes. |
show_legend
show_legend (legend_labels:list, legend_handles:list, rawdata_axes:matplotlib.axes._axes.Axes, contrast_axes:matplotlib.axes._axes.Axes, table_axes:matplotlib.axes._axes.Axes, float_contrast:bool, show_pairs:bool, horizontal:bool, legend_kwargs:dict, table_kwargs:dict)
Show the legend for the plotter function.
| Type | Details | |
|---|---|---|
| legend_labels | list | A list of legend labels. |
| legend_handles | list | A list of legend handles. |
| rawdata_axes | Axes | The raw data axes. |
| contrast_axes | Axes | The contrast axes. |
| table_axes | Axes | The table axes. |
| float_contrast | bool | A boolean flag to determine if the plot is GA or Cumming format. |
| show_pairs | bool | A boolean flag to determine if the plot will show the paired data. |
| horizontal | bool | A boolean flag to determine if the plot is for horizontal plotting. |
| legend_kwargs | dict | Kwargs passed to the legend function. |
| table_kwargs | dict |
set_xaxis_ticks_and_lims
set_xaxis_ticks_and_lims (show_delta2:bool, show_mini_meta:bool, rawdata_axes:matplotlib.axes._axes.Axes, contrast_axes:matplotlib.axes._axes.Axes, show_pairs:bool, float_contrast:bool, ticks_to_skip:list, contrast_xtick_labels:list, plot_kwargs:dict, proportional:bool, horizontal:bool)
Set the x-axis/yaxis ticks and limits for the plotter function.
| Type | Details | |
|---|---|---|
| show_delta2 | bool | A boolean flag to determine if the plot will have a delta-delta effect size. |
| show_mini_meta | bool | A boolean flag to determine if the plot will have a mini-meta effect size. |
| rawdata_axes | Axes | The raw data axes. |
| contrast_axes | Axes | The contrast axes. |
| show_pairs | bool | A boolean flag to determine if the plot will show the paired data. |
| float_contrast | bool | A boolean flag to determine if the plot is a GA or Cumming design. |
| ticks_to_skip | list | A list of ticks to skip. |
| contrast_xtick_labels | list | A list of contrast xtick labels. |
| plot_kwargs | dict | Kwargs passed to the plot function. |
| proportional | bool | |
| horizontal | bool | A boolean flag to determine if the plot is for horizontal plotting. |
extract_contrast_plotting_ticks
extract_contrast_plotting_ticks (is_paired:bool, show_pairs:bool, two_col_sankey:bool, plot_groups:list, idx:list, sankey_control_group:list)
Extract the contrast plotting ticks from the idx object for use in the plotter function.
| Type | Details | |
|---|---|---|
| is_paired | bool | A boolean flag to determine if the plot is for paired data. |
| show_pairs | bool | A boolean flag to determine if the plot will show the paired data. |
| two_col_sankey | bool | A boolean flag to determine if the plot will show a two-column sankey diagram. |
| plot_groups | list | A list of the plot groups. |
| idx | list | A list of tuples containing the group names. |
| sankey_control_group | list | A list of the control group names. |
add_counts_to_ticks
add_counts_to_ticks (plot_data:pandas.core.frame.DataFrame, xvar:str, yvar:str, rawdata_axes:matplotlib.axes._axes.Axes, plot_kwargs:dict, flow:bool, horizontal:bool)
Add the counts to the raw data axes labels.
| Type | Details | |
|---|---|---|
| plot_data | DataFrame | A dataframe of plot data. |
| xvar | str | The name of the x-axis variable. |
| yvar | str | The name of the y-axis variable. |
| rawdata_axes | Axes | The raw data axes. |
| plot_kwargs | dict | Kwargs passed to the plot function. |
| flow | bool | Whether sankey flow is enabled or not. |
| horizontal | bool | A boolean flag to determine if the plot is for horizontal plotting. |
get_plot_groups
get_plot_groups (is_paired:bool, idx:list, proportional:bool, all_plot_groups:list)
Extract the plot groups from the idx object for use in the plotter function.
| Type | Details | |
|---|---|---|
| is_paired | bool | A boolean flag to determine if the plot is for paired data. |
| idx | list | A list of tuples containing the group names. |
| proportional | bool | A boolean flag to determine if the plot is for proportional data. |
| all_plot_groups | list | A list of all the group names. |
initialize_fig
initialize_fig (plot_kwargs:dict, dabest_obj:object, show_delta2:bool, show_mini_meta:bool, is_paired:bool, show_pairs:bool, proportional:bool, float_contrast:bool, effect_size_type:str, yvar:str, horizontal:bool, show_table:bool, color_col:str)
Initialize the figure and axes for the plotter function.
| Type | Details | |
|---|---|---|
| plot_kwargs | dict | Kwargs passed to the plot function. |
| dabest_obj | object | A dabest EffectSizeDataFrame object. |
| show_delta2 | bool | A boolean flag to determine if the plot will have a delta-delta effect size. |
| show_mini_meta | bool | A boolean flag to determine if the plot will have a mini-meta effect size. |
| is_paired | bool | A boolean flag to determine if the plot is for paired data. |
| show_pairs | bool | A boolean flag to determine if the plot will show the paired data. |
| proportional | bool | A boolean flag to determine if the plot is for proportional data. |
| float_contrast | bool | A boolean flag to determine if the plot is for floating contrast data. |
| effect_size_type | str | The type of effect size to be plotted. |
| yvar | str | The name of the y-axis variable. |
| horizontal | bool | A boolean flag to determine if the plot is for horizontal plotting. |
| show_table | bool | A boolean flag to determine if the table will be shown in horizontal plot. |
| color_col | str | The column name for coloring the data points. |
get_color_palette
get_color_palette (plot_kwargs:dict, plot_data:pandas.core.frame.DataFrame, xvar:str, show_pairs:bool, idx:list, all_plot_groups:list, delta2:bool, proportional:bool)
Create the color palette to be used in the plotter function.
| Type | Details | |
|---|---|---|
| plot_kwargs | dict | Kwargs passed to the plot function. |
| plot_data | DataFrame | A dataframe of plot data. |
| xvar | str | The name of the x-axis variable. |
| show_pairs | bool | A boolean flag to determine if the plot is for paired data. |
| idx | list | A list of tuples containing the group names. |
| all_plot_groups | list | A list of all the group names. |
| delta2 | bool | A boolean flag to determine if the plot will have a delta-delta effect size. |
| proportional | bool | A boolean flag to determine if the plot is for a proportional plot. |
get_kwargs
get_kwargs (plot_kwargs:dict, ytick_color, is_paired:bool=False)
Extracts the kwargs from the plot_kwargs object for use in the plotter function.
| Type | Default | Details | |
|---|---|---|---|
| plot_kwargs | dict | Kwargs passed to the plot function. | |
| ytick_color | str or color list | Color of the yticks. | |
| is_paired | bool | False | A boolean flag to determine if the plot is for paired data. Default is False. |
get_params
get_params (effectsize_df:object, plot_kwargs:dict, sankey_kwargs:dict, barplot_kwargs:dict)
Extracts parameters from the effectsize_df and plot_kwargs objects for use in the plotter function.
| Type | Details | |
|---|---|---|
| effectsize_df | object | A dabest EffectSizeDataFrame object. |
| plot_kwargs | dict | Kwargs passed to the plot function. |
| sankey_kwargs | dict | |
| barplot_kwargs | dict | Kwargs relating to the barplot |
get_unique_categories
get_unique_categories (names)
Extract unique categories from various input types.
get_varname
get_varname (obj)
print_greeting
print_greeting ()
*Generates a greeting message based on the current time, along with the version information of DABEST.
This function dynamically generates a greeting (‘Good morning’, ‘Good afternoon’, ‘Good evening’) based on the current system time. It also retrieves and displays the version of DABEST (Data Analysis using Bootstrap-Coupled ESTimation). The message includes a header with the DABEST version and the current time formatted in a user-friendly manner.
Returns: str: A formatted string containing the greeting message, DABEST version, and current time.*
unpack_and_add
unpack_and_add (l, c)
Convenience function to allow me to add to an existing list without altering that list.
merge_two_dicts
merge_two_dicts (x:dict, y:dict)
*Given two dicts, merge them into a new dict as a shallow copy. Any overlapping keys in y will override the values in x.
Taken from here*
| Type | Details | |
|---|---|---|
| x | dict | |
| y | dict | |
| Returns | dict | A dictionary containing a union of all keys in both original dicts. |