c'est le sujet 8 du tp tkinter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
516 B

5 months ago
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(100, 220) # les tailles extrèmes en cm
# Attention, x est en cm, mais les calculs se font avec x en m
plt.fill_between(x, 0, 18.5 * (x/100)**2, label="sous poids",color="LightBlue") # sous poids si 0 <= y <= 18.5 * x²
plt.fill_between(x, 18.5 * (x/100)**2, 25 * (x/100)**2, label="poids idéal",color="yellow") # idéal si 18.5 * x² <= y <= 25 * x²
plt.xlabel('Taille (cm)')
plt.ylabel('Poids (kg)')
plt.title('IMC')
plt.legend()
plt.show()