# Variation: ChartType=Multi-Axes Chart, Library=matplotlib import pandas as pd import matplotlib.pyplot as plt # ----- Updated Data (minor tweaks, added Colombia) ----- countries = [ "South Africa", "Thailand", "Venezuela", "Chile", "Argentina", "Nigeria", "India", "Kenya", "Bangladesh (SA)", "Ethiopia", "Ghana", "Uganda", "Mozambique", "Rwanda", "Eritrea", "Tanzania", "Zambia", "Namibia", "Botswana", "Peru", "Colombia" ] # Slightly adjusted 2024 shares (+0.2 on most, new value for Colombia) base_2024 = [ 17.1, 57.7, 37.8, 31.3, 25.3, 44.8, 22.9, 28.4, 34.0, 31.4, 27.3, 27.8, 31.4, 32.9, 29.3, 20.8, 25.5, 22.3, 18.8, 30.2, 28.5 ] region_map = { "South Africa": "Sub‑Saharan Africa", "Nigeria": "Sub‑Saharan Africa", "Kenya": "Sub‑Saharan Africa", "Ethiopia": "Sub‑Saharan Africa", "Ghana": "Sub‑Saharan Africa", "Uganda": "Sub‑Saharan Africa", "Mozambique": "Sub‑Saharan Africa", "Rwanda": "Sub‑Saharan Africa", "Eritrea": "Sub‑Saharan Africa", "Tanzania": "Sub‑Saharan Africa", "Zambia": "Sub‑Saharan Africa", "Namibia": "Sub‑Saharan Africa", "Botswana": "Sub‑Saharan Africa", "India": "South Asia", "Bangladesh (SA)": "South Asia", "Thailand": "South Asia", "Venezuela": "Latin America", "Chile": "Latin America", "Argentina": "Latin America", "Peru": "Latin America", "Colombia": "Latin America" } records = [] for country, v2024 in zip(countries, base_2024): v2022 = round(v2024 - 1.5, 1) # approximate 2022 value v2023 = round(v2024 - 0.5, 1) # approximate 2023 value avg_share = round((v2022 + v2023 + v2024) / 3, 2) growth_rate = round((v2024 - v2022) / v2022 * 100, 2) # % increase from 2022 to 2024 records.append({ "Country": country, "Region": region_map[country], "AvgShare": avg_share, "GrowthRate": growth_rate }) df = pd.DataFrame(records) # Sort by AvgShare for clearer visual ordering df = df.sort_values("AvgShare", ascending=False) # ----- Multi‑Axes Chart (Bar + Line) ----- fig, ax1 = plt.subplots(figsize=(12, 6)) # Bar chart for average share bars = ax1.bar( df["Country"], df["AvgShare"], color=plt.cm.Paired(range(len(df))), label="Avg Share (%)" ) ax1.set_xlabel("Country") ax1.set_ylabel("Average Female Employment Share (%)", color="tab:blue") ax1.tick_params(axis="y", labelcolor="tab:blue") ax1.set_xticklabels(df["Country"], rotation=45, ha="right") # Secondary y‑axis for growth rate ax2 = ax1.twinx() line = ax2.plot( df["Country"], df["GrowthRate"], color="tab:red", marker="o", linewidth=2, label="Growth Rate (2022‑2024) %" ) ax2.set_ylabel("Growth Rate (%)", color="tab:red") ax2.tick_params(axis="y", labelcolor="tab:red") # Unified legend handles = [bars, line[0]] labels = [h.get_label() for h in handles] ax1.legend(handles, labels, loc="upper left") plt.title("Average Vulnerable Female Employment Share & Growth (2022‑2024) by Country") plt.tight_layout() plt.savefig("female_employment_multi_axes.png", dpi=300) plt.close()