def get_binary_cp_bar_plot()

in src/responsibleai/rai_analyse/_score_card/common_components.py [0:0]


def get_binary_cp_bar_plot(data, m):
    metric_name = m
    y_data = [y["cohort_short_name"] for y in data["cohorts"]]
    x_data = [int(x[metric_name] * 100) for x in data["cohorts"]]
    x_data = [[x, 100 - x] for x in x_data]
    legend = [m]
    tickvals = [0, 25, 50, 75, 100]
    ticktext = [str(x) + "%" for x in tickvals]

    return get_bar_plot(
        y_data,
        x_data,
        legend=legend,
        tickvals=tickvals,
        ticktext=ticktext,
        tickappend="%",
    )