import numpy as np
import matplotlib.pyplot as plt

#on rentre les valeurs voulues en abscisses
P=np.array([?,?,?])

#on rentre les valeurs voulues en ordonnée
V=np.array([?,?,?])

#calcul du produit pV et stats
mariotte=P*V
mariotte_moy=np.mean(mariotte)
u_mariotte=np.std(mariotte)/np.sqrt(len(mariotte))

#regression
a,b=np.polyfit(1/V,P,1)
yreg=a/V+b

plt.subplot(211)
plt.hist(mariotte, color = 'yellow', edgecolor = 'red')
plt.axvline(mariotte_moy,color='b')
#representation graphique
plt.title('Histogramme')
#plt.legend()
plt.xlabel('PV en kPa/mL')
plt.ylabel('Effectif')
plt.figtext(0.7,0.8,r'$pV$(moy)=%.0f'%(mariotte_moy))

plt.subplot(212)
plt.plot(1/V,P,'bo',label='mesures')
plt.plot(1/V,yreg,'r-',label=r'regression : $y=(%.2e)x+%.2e$'%(a,b))
plt.xlabel('1/V en mL-1')
plt.ylabel('P en kPa')
plt.legend()
plt.show()
