misc_tools
prepare_bars_for_plot
def prepare_bars_for_plot(
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
):
Call self as a function.
color_picker
def color_picker(
color_type:str, kwargs:dict, elements:list, color_col:str, show_pairs:bool, color_palette:dict,
bootstraps_color_by_group:bool
)->list:
Call self as a function.
extract_group_summaries
def extract_group_summaries(
proportional:bool, # A boolean flag to determine if the plot is for proportional data.
rawdata_axes: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, # The name of the color column.
ytick_color, # The color of the y-ticks.
group_summaries_kwargs:dict, # Kwargs passed to the group summaries.
):
Extract the group summaries for the plotter function.
redraw_dependent_spines
def redraw_dependent_spines(
rawdata_axes:axes.Axes, # The raw data axes.
contrast_axes: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.Axes, # The delta2 axes.
):
Draw the dependent axis spine lines.
redraw_independent_spines
def redraw_independent_spines(
rawdata_axes:axes.Axes, # The raw data axes.
contrast_axes: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 the independent axis spine lines.
draw_zeroline
def draw_zeroline(
ax:axes.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).
):
Draw the independent axis spine lines.
gardner_altman_adjustments
def gardner_altman_adjustments(
effect_size_type:str, # The type of effect size.
plot_data:pd.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.Axes, # The raw data axes.
contrast_axes:axes.Axes, # The contrast axes.
results:pd.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.
):
Aesthetic adjustments specific to Gardner-Altman plots (float_contrast=True).
show_legend
def show_legend(
legend_labels:list, # A list of legend labels.
legend_handles:list, # A list of legend handles.
rawdata_axes:axes.Axes, # The raw data axes.
contrast_axes:axes.Axes, # The contrast axes.
table_axes: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
):
Show the legend for the plotter function.
set_xaxis_ticks_and_lims
def set_xaxis_ticks_and_lims(
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.Axes, # The raw data axes.
contrast_axes: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.
):
Set the x-axis/yaxis ticks and limits for the plotter function.
extract_contrast_plotting_ticks
def extract_contrast_plotting_ticks(
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.
):
Extract the contrast plotting ticks from the idx object for use in the plotter function.
add_counts_to_ticks
def add_counts_to_ticks(
plot_data:pd.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.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.
):
Add the counts to the raw data axes labels.
get_plot_groups
def get_plot_groups(
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.
):
Extract the plot groups from the idx object for use in the plotter function.
initialize_fig
def initialize_fig(
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.
):
Initialize the figure and axes for the plotter function.
get_color_palette
def get_color_palette(
plot_kwargs:dict, # Kwargs passed to the plot function.
plot_data:pd.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.
):
Create the color palette to be used in the plotter function.
get_kwargs
def get_kwargs(
plot_kwargs:dict, # Kwargs passed to the plot function.
ytick_color, # Color of the yticks.
is_paired:bool=False, # A boolean flag to determine if the plot is for paired data. Default is False.
):
Extracts the kwargs from the plot_kwargs object for use in the plotter function.
get_params
def get_params(
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
):
Extracts parameters from the effectsize_df and plot_kwargs objects for use in the plotter function.
get_unique_categories
def get_unique_categories(
names
):
Extract unique categories from various input types.
get_varname
def get_varname(
obj
):
Call self as a function.
print_greeting
def 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
def unpack_and_add(
l, c
):
Convenience function to allow me to add to an existing list without altering that list.
merge_two_dicts
def merge_two_dicts(
x:dict, y:dict
)->dict: # A dictionary containing a union of all keys in both original dicts.
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