SPB Git
2.2 KB · 34 lines python
1#!/usr/bin/env python32"""Ch. 34, figure « trajectoires RBP » : revenu brut potentiel contractuel du cas 3 (DONNÉES SYNTHÉTIQUES) selon la rotation3(5, 15, 25 % ; pourcentage de base 3,1 %), avec le RBP au marché (+3,5 %/an), l'indexation seule et le scénario d'encadrement4renforcé (base 2 %, rotation 8 %, rattrapage partiel φ = 0,5, marché 3 %). Sortie : ch34-fig-trajectoires-rbp.pdf."""5from __future__ import annotations6import sys, pathlib7sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))8import matplotlib.pyplot as plt9from matplotlib.ticker import FuncFormatter10from traite import cas311from traite.style import setup, palette, savefig, LARGEUR, fmt_milliers12from cases import ch34_tal as c1314def main():15    setup()16    d = cas3.tout(); hyp = d["hyp"]17    fig, ax = plt.subplots(figsize=(LARGEUR, 3.9))18    base = c.valeur_scenario(d)["projection"]; x = base["exercice"].values19    ax.plot(x, base["rbp_marche"] / 1000, color=palette.ink2, lw=1.2, ls="--", label="RBP au loyer de marché (+3,5 %/an)")20    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)")):21        p = c.valeur_scenario(d, rotation=rho)["projection"]22        ax.plot(x, p["rbp"] / 1000, color=col, marker="o", ms=3, label=f"RBP contractuel, base 3,1 %, {lab}")23    p0 = c.valeur_scenario(d, rotation=0.0)["projection"]24    ax.plot(x, p0["rbp"] / 1000, color=palette.cat[0], ls=":", lw=1.2, label="Indexation seule (aucune relocation)")25    pr = c.valeur_scenario(d, g_c=0.02, rotation=0.08, fraction_rattrapage=0.5, g_m=0.03)["projection"]26    ax.plot(x, pr["rbp"] / 1000, color=palette.cat[3], marker="s", ms=3, label="Encadrement renforcé (base 2 %, rotation 8 %, φ = 0,5)")27    ax.set_xticks(x); ax.set_xlabel("Exercice"); ax.set_ylabel("Revenu brut potentiel (milliers de $)")28    ax.yaxis.set_major_formatter(FuncFormatter(lambda v, q: fmt_milliers(v)))29    ax.legend(loc="upper center", bbox_to_anchor=(0.5, -0.16), fontsize=7.2, ncol=2)30    savefig(fig, "ch34/ch34-fig-trajectoires-rbp.pdf")3132if __name__ == "__main__":33    main()34
Files · 2eb2bf4e67f754808bae5090a9e53eab37149ddb
Menu

Theme