मात्रात्मक तुलना: हिस्टोग्राम

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

Ariel Rokem

Data Scientist

हिस्टोग्राम

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

फिर से बार चार्ट

fig, ax = plt.subplots()

ax.bar("Rowing", mens_rowing["Height"].mean())
ax.bar("Gymnastics", mens_gymnastics["Height"].mean())
ax.set_ylabel("Height (cm)") plt.show()

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

हिस्टोग्राम का परिचय

fig, ax = plt.subplots()

ax.hist(mens_rowing["Height"])
ax.hist(mens_gymnastics["Height"])
ax.set_xlabel("Height (cm)") ax.set_ylabel("# of observations") plt.show()

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

लेबल ज़रूरी हैं

ax.hist(mens_rowing["Height"], label="Rowing")
ax.hist(mens_gymnastics["Height"], label="Gymnastics")
ax.set_xlabel("Height (cm)")
ax.set_ylabel("# of observations")

ax.legend() plt.show()

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

हिस्टोग्राम कस्टमाइज़ करना: बिन्स की संख्या सेट करना

ax.hist(mens_rowing["Height"], label="Rowing", bins=5)
ax.hist(mens_gymnastics["Height"], label="Gymnastics", bins=5)
ax.set_xlabel("Height (cm)")
ax.set_ylabel("# of observations")
ax.legend()
plt.show()

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

हिस्टोग्राम कस्टमाइज़ करना: बिन सीमाएँ सेट करना

ax.hist(mens_rowing["Height"], label="Rowing",
        bins=[150, 160, 170, 180, 190, 200, 210])

ax.hist(mens_gymnastics["Height"], label="Gymnastics",
        bins=[150, 160, 170, 180, 190, 200, 210])

ax.set_xlabel("Height (cm)")
ax.set_ylabel("# of observations")
ax.legend()
plt.show()

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

हिस्टोग्राम कस्टमाइज़ करना: ट्रांसपेरेंसी

ax.hist(mens_rowing["Height"], label="Rowing",
        bins=[150, 160, 170, 180, 190, 200, 210],
        histtype="step")

ax.hist(mens_gymnastics["Height"], label="Gymnastics",
        bins=[150, 160, 170, 180, 190, 200, 210],
        histtype="step")

ax.set_xlabel("Height (cm)")
ax.set_ylabel("# of observations")
ax.legend()
plt.show()
Matplotlib के साथ डेटा विज़ुअलाइज़ेशन परिचय

histtype 'step' वाला हिस्टोग्राम

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

अपना हिस्टोग्राम बनाएँ!

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

Preparing Video For Download...