#!/usr/bin/env python3 """Figure ch05 — gradients du modèle monocentrique simulé (PARAMÈTRES PÉDAGOGIQUES DÉCLARÉS dans ch05_rente.PARAMS). Panneau gauche : courbes d'enchère linéaires de trois usages et leur enveloppe (Alonso) ; panneau droit : prix du logement, rente foncière et densité relative du modèle de Muth–Mills, avec l'approximation exponentielle. Sortie : assets/figures/ch05/ch05-fig-gradient-monocentrique.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 numpy as np import matplotlib.pyplot as plt from traite.style import setup, palette, savefig, LARGEUR import ch05_rente as c5 def main(): setup() P = c5.PARAMS fig, (a1, a2) = plt.subplots(1, 2, figsize=(LARGEUR, 3.1), gridspec_kw={"wspace": 0.32}) # --- Alonso d = np.linspace(0, 36, 400) env, courbes = c5.enveloppe_alonso(d) for k, (nom, y) in enumerate(courbes.items()): a1.plot(d, np.clip(y, 0, None), color=palette.cat[k], lw=1.1, alpha=0.85, label=nom) a1.plot(d, env, color=palette.ink, lw=2.0, label="Enveloppe (rente de marché)") a1.axhline(P["ra"], color=palette.ink2, lw=0.8, ls=":") a1.text(0.5, P["ra"] + 4, "rente agricole", fontsize=7, color=palette.ink2) (R1, t1), (R2, t2), (R3, t3) = c5.ALONSO.values() for x in (c5.frontiere_usages(R1, t1, R2, t2), c5.frontiere_usages(R2, t2, R3, t3), (R3 - P["ra"]) / t3): a1.axvline(x, color=palette.grid, lw=0.8, ls="--") a1.set_ylim(0, 140); a1.set_xlim(0, 36) a1.set_xlabel("Distance au centre (km)"); a1.set_ylabel("Rente foncière ($/m² de terrain/an)") a1.set_title("A. Courbes d'enchère et enveloppe", loc="left", fontsize=8.5) a1.legend(fontsize=6.8, loc="upper right") # --- Muth–Mills dbar = c5.frontiere_urbaine(P) d2 = np.linspace(0, dbar, 400) a2.plot(d2, c5.prix_logement(d2) / P["p0"], color=palette.cat[0], lw=1.8, label="Prix du logement $p(d)/p_0$") a2.plot(d2, c5.prix_exponentiel(d2) / P["p0"], color=palette.cat[0], lw=1.0, ls="--", label="Approximation exponentielle") a2.plot(d2, c5.rente_fonciere(d2) / P["r0"], color=palette.cat[1], lw=1.8, label="Rente foncière $r(d)/r_0$") a2.plot(d2, c5.densite(d2), color=palette.cat[2], lw=1.8, label="Densité $D(d)/D_0$") a2.axvline(dbar, color=palette.ink2, lw=0.8, ls=":") a2.text(dbar - 0.6, 0.47, f"frontière\nurbaine\n{dbar:.1f} km", fontsize=7, color=palette.ink2, ha="right") a2.set_xlim(0, dbar + 1); a2.set_ylim(0, 1.05) a2.set_xlabel("Distance au centre (km)"); a2.set_ylabel("Niveau relatif au centre (= 1)") a2.set_title("B. Gradients du modèle de Muth–Mills", loc="left", fontsize=8.5) a2.legend(fontsize=6.8, loc="upper right") out = savefig(fig, "ch05/ch05-fig-gradient-monocentrique.pdf"); print("OK", out) if __name__ == "__main__": main()