#!/usr/bin/env python3 """Ch. 34, figure « trajectoires RBP » : revenu brut potentiel contractuel du cas 3 (DONNÉES SYNTHÉTIQUES) selon la rotation (5, 15, 25 % ; pourcentage de base 3,1 %), avec le RBP au marché (+3,5 %/an), l'indexation seule et le scénario d'encadrement renforcé (base 2 %, rotation 8 %, rattrapage partiel φ = 0,5, marché 3 %). Sortie : ch34-fig-trajectoires-rbp.pdf.""" from __future__ import annotations import sys, pathlib sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter from traite import cas3 from traite.style import setup, palette, savefig, LARGEUR, fmt_milliers from cases import ch34_tal as c def main(): setup() d = cas3.tout(); hyp = d["hyp"] fig, ax = plt.subplots(figsize=(LARGEUR, 3.9)) base = c.valeur_scenario(d)["projection"]; x = base["exercice"].values ax.plot(x, base["rbp_marche"] / 1000, color=palette.ink2, lw=1.2, ls="--", label="RBP au loyer de marché (+3,5 %/an)") for rho, col, lab in ((0.05, palette.cat[2], "rotation 5 % (1 logement/an)"), (0.15, palette.cat[0], "rotation 15 % (2 logements/an) — base du dossier"), (0.25, palette.cat[1], "rotation 25 % (3 logements/an)")): p = c.valeur_scenario(d, rotation=rho)["projection"] ax.plot(x, p["rbp"] / 1000, color=col, marker="o", ms=3, label=f"RBP contractuel, base 3,1 %, {lab}") p0 = c.valeur_scenario(d, rotation=0.0)["projection"] ax.plot(x, p0["rbp"] / 1000, color=palette.cat[0], ls=":", lw=1.2, label="Indexation seule (aucune relocation)") pr = c.valeur_scenario(d, g_c=0.02, rotation=0.08, fraction_rattrapage=0.5, g_m=0.03)["projection"] ax.plot(x, pr["rbp"] / 1000, color=palette.cat[3], marker="s", ms=3, label="Encadrement renforcé (base 2 %, rotation 8 %, φ = 0,5)") ax.set_xticks(x); ax.set_xlabel("Exercice"); ax.set_ylabel("Revenu brut potentiel (milliers de $)") ax.yaxis.set_major_formatter(FuncFormatter(lambda v, q: fmt_milliers(v))) ax.legend(loc="upper center", bbox_to_anchor=(0.5, -0.16), fontsize=7.2, ncol=2) savefig(fig, "ch34/ch34-fig-trajectoires-rbp.pdf") if __name__ == "__main__": main()