Personnaliser vos graphiques

Introduction à la visualisation de données avec Matplotlib

Ariel Rokem

Data Scientist

Personnaliser l'apparence des données

ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-PRCP-NORMAL"])
plt.show()

Introduction à la visualisation de données avec Matplotlib

Ajouter des marqueurs

ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-PRCP-NORMAL"], 
        marker="o")
plt.show()

Introduction à la visualisation de données avec Matplotlib

Choisir les marqueurs

ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-PRCP-NORMAL"], 
        marker="v")
plt.show()

https://matplotlib.org/api/markers_api.html

Introduction à la visualisation de données avec Matplotlib

Définir le style de ligne

fig, ax = plt.subplots()
ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-TAVG-NORMAL"],
        marker="v", linestyle="--")
plt.show()

Introduction à la visualisation de données avec Matplotlib

Supprimer les lignes avec linestyle

fig, ax = plt.subplots()
ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-TAVG-NORMAL"],
        marker="v", linestyle="None")
plt.show()

Introduction à la visualisation de données avec Matplotlib

Choisir la couleur

fig, ax = plt.subplots()
ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-TAVG-NORMAL"],
        marker="v", linestyle="--", color="r")
plt.show()

Introduction à la visualisation de données avec Matplotlib

Personnaliser les étiquettes des axes

ax.set_xlabel("Time (months)")
plt.show()

Introduction à la visualisation de données avec Matplotlib

Définir l'étiquette de l'axe y

ax.set_xlabel("Time (months)")
ax.set_ylabel("Average temperature (Fahrenheit degrees)")
plt.show()

Introduction à la visualisation de données avec Matplotlib

Ajouter un titre

ax.set_title("Weather in Seattle")
plt.show()

Introduction à la visualisation de données avec Matplotlib

Passons à la pratique !

Introduction à la visualisation de données avec Matplotlib

Preparing Video For Download...