#!/usr/bin/env python3 """Figure ch07 — sensibilité de la cotisation de seuil A* à l'inflation des coûts et au rendement du fonds (DONNÉES SYNTHÉTIQUES). Sortie : assets/figures/ch07/ch07-fig-sensibilite-cotisation.pdf""" import sys, pathlib ROOT = pathlib.Path(__file__).resolve().parents[3] sys.path.insert(0, str(ROOT / "analysis/python")); sys.path.insert(0, str(ROOT / "analysis/python/cases")) import matplotlib.pyplot as plt from traite.style import setup, palette, savefig, LARGEUR, fmt_dollars import ch07_servitudes_copro as cas def main(): setup() s = cas.sensibilite_cotisation(); regle = 0.005 * cas.VALEUR_RECONSTRUCTION fig, ax = plt.subplots(figsize=(LARGEUR, 3.2)) for i, (r, row) in enumerate(s["grille"].items()): ax.plot([p * 100 for p in s["inflations"]], row, marker="o", color=palette.cat[i], label=f"rendement du fonds r = {r*100:.0f} %") ax.axhline(regle, color=palette.ink2, lw=0.9, ls=":") ax.text(1.52, regle + 250, "règle du 0,5 % de la valeur de reconstruction (21 000 $)", fontsize=7.5, color=palette.ink2) ax.axhline(cas.COTISATION_ACTUELLE, color=palette.cat[3], lw=0.9, ls=":") ax.text(1.52, cas.COTISATION_ACTUELLE + 250, "cotisation actuelle (12 000 $)", fontsize=7.5, color=palette.cat[3]) ax.set_xlabel("Hausse annuelle des coûts de construction π (%)"); ax.set_ylabel("Cotisation de seuil A* (an 1)") ax.yaxis.set_major_formatter(plt.FuncFormatter(fmt_dollars)); ax.set_ylim(10000, 26000) ax.legend(loc="lower right", fontsize=7.5) out = savefig(fig, "ch07/ch07-fig-sensibilite-cotisation.pdf"); print("OK", out) if __name__ == "__main__": main()