Last active
March 19, 2019 23:24
-
-
Save YannBouyeron/c209a4e3aec57bf8ccf0034dc2dee67e to your computer and use it in GitHub Desktop.
Appartenance à la lignée humaine - Graphique boxplot - Python Pandas Matplotlib - https://github.com/YannBouyeron/SVT-TS/blob/master/Génétique%20et%20évolution/T1A-A11%20-%20correction.pdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
matplotlib.use('Agg') # supprimez cette ligne si vous avez une interface graphique (bureau avec dossiers et fond d'écran ridicule..) | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
# angles faciaux | |
af = {"Australo":[56, 75], "habilis":[65, 68], "erectus":[75,81], "néandertal":[71,89],"sapiens":[82,88], "chimpanzé":[34,45], "gorille":[34,47]} | |
af = pd.DataFrame(af) | |
plt.close() | |
pb = af.boxplot(fontsize=7) | |
plt.xlabel("Espèces", fontsize=8) | |
plt.ylabel("Angle facial (degrés)", fontsize=8) | |
plt.title("Angle facial", fontsize= 10) | |
plt.axhline(y=78, hold=None, color="r", linestyle="--") # ligne horizontale correspondant au fossile STGM dont l'angle est de 78° | |
plt.annotate('Fossile STGM', xy=(1, 78), xytext=(1.3, 82), fontsize=8, arrowprops=dict(headwidth=4, headlength=2, width=0.4, facecolor='black', shrink=0.05),) | |
plt.savefig("angle_facial.png") | |
# rapport hauteur longueur | |
hl = {"Australo":[0.58,0.67], "habilis":[0.48,0.66], "erectus":[0.46,0.54], "néandertal":[0.45,0.63],"sapiens":[0.59,0.64], "chimpanzé":[0.4,0.47], "gorille":[0.38,0.46]} | |
hl = pd.DataFrame(hl) | |
plt.close() | |
pbb = hl.boxplot(fontsize=7) | |
plt.xlabel("Espèces", fontsize=8) | |
plt.ylabel("Rapport H/L", fontsize=8) | |
plt.title("Hauteur / Longueur", fontsize= 10) | |
plt.axhline(y=0.5, hold=None, color="r", linestyle="--") # ligne horizontale correspondant au fossile STGM de rapport h/l = 0.5 | |
plt.annotate('Fossile STGM', xy=(5, 0.5), xytext=(5, 0.53), fontsize=8, arrowprops=dict(headwidth=4, headlength=2, width=0.4, facecolor='black', shrink=0.05),) | |
plt.savefig("hauteurlongueur.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment