Múltiplos pequenos

Introdução à Visualização de Dados com a Matplotlib

Ariel Rokem

Data Scientist

Adicionando dados

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

Introdução à Visualização de Dados com a Matplotlib

Adicionando mais dados

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()

Introdução à Visualização de Dados com a Matplotlib

E mais dados

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()
Introdução à Visualização de Dados com a Matplotlib

Dados demais!

Introdução à Visualização de Dados com a Matplotlib

Múltiplos pequenos com plt.subplots

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

plt.show()

Introdução à Visualização de Dados com a Matplotlib

Como adicionar dados a subgráficos

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

plt.show()

Introdução à Visualização de Dados com a Matplotlib

Subgráficos com dados

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()
Introdução à Visualização de Dados com a Matplotlib

Subgráficos com dados

Introdução à Visualização de Dados com a Matplotlib

Compartilhamento do intervalo do eixo y

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

Introdução à Visualização de Dados com a Matplotlib

Pratique a criação de subgráficos!

Introdução à Visualização de Dados com a Matplotlib

Preparing Video For Download...