स्मॉल मल्टिपल्स

Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

Ariel Rokem

Data Scientist

डेटा जोड़ना

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

Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

और डेटा जोड़ना

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

Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

और भी डेटा

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()
Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

बहुत ज़्यादा डेटा!

Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

plt.subplots के साथ स्मॉल मल्टिपल्स

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

plt.show()

Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

सबप्लॉट्स में डेटा जोड़ना

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

plt.show()

Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

डेटा के साथ सबप्लॉट्स

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()
Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

डेटा के साथ सबप्लॉट्स

Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

y-axis रेंज साझा करना

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

Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

आइए सबप्लॉट्स बनाकर अभ्यास करें!

Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

Preparing Video For Download...