SPB Git
2.5 KB · 34 lines python
1#!/usr/bin/env python32"""Ch. 30, figure « loyers » : trajectoire du revenu brut potentiel contractuel (indexé au taux TAL + relocation de 15 %3des logements par an au loyer de marché) et du RBP au marché, cas 3 (DONNÉES SYNTHÉTIQUES). Sortie : ch30-fig-loyers.pdf."""4from __future__ import annotations5import sys, pathlib6sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))7import matplotlib.pyplot as plt8from matplotlib.ticker import FuncFormatter9from traite.style import setup, palette, savefig, LARGEUR, fmt_milliers10from cases import ch30_dcf as c1112def main():13    setup()14    r = c.base(); p = r["projection"]; h = r["hyp"]15    fig, ax = plt.subplots(figsize=(LARGEUR, 3.1))16    x = p["exercice"].values17    ax.fill_between(x, p["rbp"] / 1000, p["rbp_marche"] / 1000, color=palette.grid, alpha=0.9, label="Écart au marché (rattrapage)")18    ax.plot(x, p["rbp_marche"] / 1000, color=palette.cat[1], marker="s", ms=3.5, label=f"RBP au loyer de marché (+{h['croissance_loyers_marche']*100:.1f} %/an)")19    ax.plot(x, p["rbp"] / 1000, color=palette.cat[0], marker="o", ms=3.5, label=f"RBP contractuel projeté (TAL {h['croissance_loyers_contrat']*100:.1f} % + rotation {h['rotation_annuelle']*100:.0f} %)")20    # contractuel sans rotation (indexation TAL seule) pour référence21    sans = [p["rbp"].iloc[0] * (1 + h["croissance_loyers_contrat"]) ** k / 1000 for k in range(len(x))]22    ax.plot(x, sans, color=palette.cat[0], ls=":", lw=1.2, label="RBP contractuel sans relocation (indexation TAL seule)")23    e0 = (p["rbp_marche"].iloc[0] - p["rbp"].iloc[0]); eT = (p["rbp_marche"].iloc[-1] - p["rbp"].iloc[-1])24    ax.annotate(f"écart {fmt_milliers(e0)} $ ({e0/p['rbp_marche'].iloc[0]*100:.1f} %)", xy=(x[0], (p["rbp"].iloc[0] + p["rbp_marche"].iloc[0]) / 2000), xytext=(x[0] + 0.3, 215), fontsize=8, arrowprops=dict(arrowstyle="-", color=palette.ink2, lw=0.7))25    ax.annotate(f"écart {fmt_milliers(eT)} $ ({eT/p['rbp_marche'].iloc[-1]*100:.1f} %)", xy=(x[-1], (p["rbp"].iloc[-1] + p["rbp_marche"].iloc[-1]) / 2000), xytext=(x[-1] - 3.6, 262), fontsize=8, arrowprops=dict(arrowstyle="-", color=palette.ink2, lw=0.7))26    ax.set_ylabel("Revenu brut potentiel (milliers de $)"); ax.set_xlabel("Exercice")27    ax.set_xticks(x); ax.yaxis.set_major_formatter(FuncFormatter(lambda v, q: fmt_milliers(v)))28    ax.set_ylim(top=p["rbp_marche"].max() / 1000 * 1.04)29    ax.legend(loc="upper left", fontsize=7.5)30    savefig(fig, "ch30/ch30-fig-loyers.pdf")3132if __name__ == "__main__":33    main()34
Files · cd76781f94cbc7113926bd8a4bd920d14c17c982
Menu

Theme