Petits multiples

Introduction à la visualisation de données avec Matplotlib

Ariel Rokem

Data Scientist

Ajout de données

ax.plot(seattle_weather["MONTH"], 
        seattle_weather["MLY-PRCP-NORMAL"], 
        color='b')
ax.set_xlabel("Time (months)")
ax.set_ylabel("Precipitation (inches)")
plt.show()

Introduction à la visualisation de données avec Matplotlib

Ajouter davantage de données

ax.plot(seattle_weather["MONTH"], seattle_weather["MLY-PRCP-25PCTL"], 
        linestyle='--', color='b')
ax.plot(seattle_weather["MONTH"], seattle_weather["MLY-PRCP-75PCTL"], 
        linestyle='--', color=color)
plt.show()

Introduction à la visualisation de données avec Matplotlib

Et davantage de données

ax.plot(austin_weather["MONTH"], austin_weather["MLY-PRCP-NORMAL"],
        color='r')
ax.plot(austin_weather["MONTH"], austin_weather["MLY-PRCP-25PCTL"], 
        linestyle='--', color='r')
ax.plot(austin_weather["MONTH"], austin_weather["MLY-PRCP-75PCTL"], 
        linestyle='--', color='r')
plt.show()
Introduction à la visualisation de données avec Matplotlib

Il y a trop de données.

Introduction à la visualisation de données avec Matplotlib

Petits multiples avec plt.subplots

fig, ax = plt.subplots()
fig, ax = plt.subplots(3, 2)

plt.show()

Introduction à la visualisation de données avec Matplotlib

Ajout de données aux sous-graphiques

ax.shape
(3, 2)
ax[0, 0].plot(seattle_weather["MONTH"], 
              seattle_weather["MLY-PRCP-NORMAL"], 
              color='b')

plt.show()

Introduction à la visualisation de données avec Matplotlib

Sous-intrigues avec données

fig, ax = plt.subplots(2, 1)

ax[0].plot(seattle_weather["MONTH"], seattle_weather["MLY-PRCP-NORMAL"], color='b') ax[0].plot(seattle_weather["MONTH"], seattle_weather["MLY-PRCP-25PCTL"], linestyle='--', color='b') ax[0].plot(seattle_weather["MONTH"], seattle_weather["MLY-PRCP-75PCTL"], linestyle='--', color='b')
ax[1].plot(austin_weather["MONTH"], austin_weather["MLY-PRCP-NORMAL"], color='r') ax[1].plot(austin_weather["MONTH"], austin_weather["MLY-PRCP-25PCTL"], linestyle='--', color='r') ax[1].plot(austin_weather["MONTH"], austin_weather["MLY-PRCP-75PCTL"], linestyle='--', color='r')
ax[0].set_ylabel("Precipitation (inches)") ax[1].set_ylabel("Precipitation (inches)")
ax[1].set_xlabel("Time (months)")
plt.show()
Introduction à la visualisation de données avec Matplotlib

Sous-intrigues avec données

Introduction à la visualisation de données avec Matplotlib

Partage de la plage de l'axe des y

fig, ax = plt.subplots(2, 1, sharey=True)

Introduction à la visualisation de données avec Matplotlib

Entraînez-vous à créer des graphiques secondaires !

Introduction à la visualisation de données avec Matplotlib

Preparing Video For Download...