Personnalisation de vos graphiques

Introduction à la visualisation de données avec Matplotlib

Ariel Rokem

Data Scientist

Personnalisation de l'affichage 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

Choix de 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éfinition du 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

Suppression de lignes avec le style de ligne

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

Choix de 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

Personnalisation des étiquettes des axes

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

Introduction à la visualisation de données avec Matplotlib

Définition de l'étiquette de l'axe des y

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

Introduction à la visualisation de données avec Matplotlib

Ajout d’un titre

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

Introduction à la visualisation de données avec Matplotlib

Entraînez-vous à personnaliser vos graphiques !

Introduction à la visualisation de données avec Matplotlib

Preparing Video For Download...