def _bar_stacked_example_3()

in chartify/examples.py [0:0]


def _bar_stacked_example_3(quantity_by_fruit_and_country):
    """Docstring"""
    # Get the ordered list of quantity by country to order the stacks.
    country_order = (
        quantity_by_fruit_and_country.groupby("country")["quantity"].sum().sort_values(ascending=False).index
    )
    (
        chartify.Chart(blank_labels=True, x_axis_type="categorical")
        .set_title("Grouped bar chart - Ordered stack")
        .set_subtitle("Change the order of the stack with `stack_order`.")
        .plot.bar_stacked(
            data_frame=quantity_by_fruit_and_country,
            categorical_columns=["fruit"],
            numeric_column="quantity",
            stack_column="country",
            normalize=True,
            stack_order=country_order,
        )
        .show(_OUTPUT_FORMAT)
    )
    """Print break"""
    return country_order