Kategorik verileri görselleştirme

Bokeh ile Etkileşimli Veri Görselleştirme

George Boorman

Core Curriculum Manager, DataCamp

Kategorik veri

  • Kategorik veri, sabit sayıda seçenek ya da etikete sahip veridir.

    • Örneklere cinsiyet veya doğum ülkesi dahildir.
  • Faktörler, kategorik değişkenler için başka bir terimdir

print(nba[["position", "team", "conference"]].head())
    position    team    conference
0   PG          OKC     West
1   PG          HOU     West
2   PG          BOS     East
3   C           NO      West
4   SG          TOR     East
Bokeh ile Etkileşimli Veri Görselleştirme

Sıralama

sıralanmamış_çubuk_grafik

pos = nba.groupby("position")["points"].mean()
pos = pos.sort_values("points", ascending=False)

fig = figure(x_range=pos["position"], x_axis_label="Pozisyon", y_axis_label="Maç başına sayı") fig.vbar(x=pos["position"], top=pos["points"]) output_file(filename="sorted_plot.html") show(fig)

sıralı_çubuk_grafik

Bokeh ile Etkileşimli Veri Görselleştirme

Dolgu

fig = figure(x_range=nba["position"], 
             x_axis_label="Pozisyon", 
             y_axis_label="Maç başına sayı")
fig.vbar(x=nba["position"], top=nba["points"],

width=0.9)
output_file(filename="padded_plot.html") show(fig)

dolgulu_sıralı_çubuk_grafik

Bokeh ile Etkileşimli Veri Görselleştirme

Yönlendirme

fig = figure(x_range=nba['position'], 
             x_axis_label="Pozisyon", 
             y_axis_label="Maç başına sayı")
fig.vbar(x=nba["position"], top=nba["points"], width=0.9)

fig.xaxis.major_label_orientation = 45
output_file(filename="rotated_x_label_plot.html") show(fig)
Bokeh ile Etkileşimli Veri Görselleştirme

Döndürülmüş x-ekseni etiketleri

yönlendirilmiş_grafik

Bokeh ile Etkileşimli Veri Görselleştirme

İç içe kategoriler

positions = ["Point Guard", "Shooting Guard", 
            "Small Forward", "Power Forward", "Center"]
conferences = ["East", "West"]

factors = [("Point Guard", "East"), ("Point Guard", "West"), ("Shooting Guard", "East"), ("Shooting Guard", "West"), ("Small Forward", "East"), ("Small Forward", "West"), ("Power Forward", "East"), ("Power Forward", "West"), ("Center", "East"), ("Center", "West")]
Bokeh ile Etkileşimli Veri Görselleştirme

Gruplanmış çubuk grafik oluşturma

from bokeh.models import FactorRange

fig = figure(x_range=FactorRange(*factors), y_axis_label="Maç başına sayı")
fig.vbar(x=factors, top=nba["points"], width=0.9)
output_file(filename="grouped_bar_plot.html") show(fig)
Bokeh ile Etkileşimli Veri Görselleştirme

Gruplanmış çubuk grafik

gruplanmış_çubuk_grafik

Bokeh ile Etkileşimli Veri Görselleştirme

Haydi pratik yapalım!

Bokeh ile Etkileşimli Veri Görselleştirme

Preparing Video For Download...