import matplotlib.pyplot as plt
# Configuration des données
salaire_annuel = 130000
jours = [0, 720, 721, 2000]
prestations = [104000, 104000, 78000, 78000] # 80% puis env. 60%
fig, ax1 = plt.subplots(figsize=(10, 6), facecolor='#3d4a71')
ax1.set_facecolor('#3d4a71')
# Dessin des zones (Prestations)
ax1.fill_between(jours, prestations, color='#5b84c4', alpha=0.8, label='Prestations')
ax1.axhline(y=130000, color='#f1c40f', linestyle='-', linewidth=2, label='Revenu / Besoins')
# Axe gauche : Prestations en CHF
ax1.set_ylabel('Prestations en CHF', color='white', fontsize=12)
ax1.tick_params(axis='y', labelcolor='white')
ax1.set_ylim(0, 140000)
ax1.set_yticks([0, 26000, 52000, 78000, 104000, 130000])
# Axe droit : POURCENTAGE DU REVENU (C'est ici la correction)
ax2 = ax1.twinx()
ax2.set_ylabel('Pourcentage du revenu', color='white', rotation=270, labelpad=20, fontsize=12)
ax2.set_ylim(0, 107.6) # Aligné sur les 140k du premier axe
ax2.set_yticks([0, 20, 40, 60, 80, 100])
ax2.tick_params(axis='y', labelcolor='white')
# Titres et style
plt.title('Incapacité de gain par suite de maladie\nSalaire annuel = CHF 130\'000', color='gold', pad=20, fontsize=14)
ax1.set_xticks([0, 721])
ax1.set_xticklabels(['Jour 1', '721'], color='white')
ax1.grid(color='white', linestyle='--', alpha=0.2)
plt.tight_layout()
plt.show()