Nicel karşılaştırmalar: histogramlar

Matplotlib ile Veri Görselleştirmeye Giriş

Ariel Rokem

Data Scientist

Histogramlar

Matplotlib ile Veri Görselleştirmeye Giriş

Yine bir çubuk grafik

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 ile Veri Görselleştirmeye Giriş

Histogramlara giriş

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 ile Veri Görselleştirmeye Giriş

Etiketler gereklidir

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 ile Veri Görselleştirmeye Giriş

Histogramları özelleştirme: bölme sayısı ayarlama

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 ile Veri Görselleştirmeye Giriş

Histogramları özelleştirme: sınırlıkları ayarlama

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 ile Veri Görselleştirmeye Giriş

Histogramları özelleştirme: saydamlık

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 ile Veri Görselleştirmeye Giriş

histtype = step ile histogram

Matplotlib ile Veri Görselleştirmeye Giriş

Kendi histogramınızı oluşturun!

Matplotlib ile Veri Görselleştirmeye Giriş

Preparing Video For Download...