Scatter Plots၊ Histograms နှင့် Box Plots
3.11.2
တွဲထားတဲ့ value၊ distribution သို့မဟုတ် ပျံ့နှံ့မှု ယှဉ်ဖို့ ကိုက်ညီတဲ့ chart ရွေးပါ။
ဒီစာမျက်နှာမှာ
တွဲထားတဲ့ Value တွေ ပြခြင်း
တွဲထားတဲ့ observation တစ်ခုစီအတွက် point တစ်ခု ပြဖို့ scatter သုံးပါ။ Point အများကြီး ထပ်နေရင် marker သေးသေး သို့မဟုတ် transparency သုံးနိုင်ပါတယ်။ Scatter plot မှာ ဆက်နွှယ်မှု တွေ့တာနဲ့ အကြောင်းရင်းလို့ သတ်မှတ်လို့မရပါ။
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.scatter([55, 85, 120], [115, 190, 270], alpha=0.75)
ax.set(xlabel="Floor area (m²)", ylabel="Price (thousands)")
plt.show()
ပုံဖိုင် ဒေါင်းလုဒ်လုပ်ရန်
Bin များဖြင့် Distribution ပြခြင်း
Histogram က default မှာ ကိန်းဂဏန်းအပိုင်းတစ်ခုစီထဲက observation အရေအတွက် ပြပါတယ်။ Bin အကျယ်ပြောင်းရင် မြင်ရတဲ့ပုံ ပြောင်းပါတယ်။ Distribution နှစ်ခု ယှဉ်ရင် bin အစွန်းတူတူ သုံးပါ။
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
counts, _, _ = ax.hist([1, 2, 3, 6, 8, 12], bins=[0, 5, 10, 15])
print(counts.astype(int).tolist())
plt.show()
ပုံဖိုင် ဒေါင်းလုဒ်လုပ်ရန်
နမူနာ ရလဒ်
[3, 2, 1]
အလယ်တန်ဖိုးနှင့် ကွာဟမှု ယှဉ်ခြင်း
Box plot က median နဲ့ ပထမ၊ တတိယ quartile ပြပါတယ်။ Default whisker က quartile ကနေ interquartile range ရဲ့ 1.5 ဆ အတွင်းက အစွန်းဆုံး point ထိ ရောက်ပါတယ်။ အပြင်က point တွေကို flier အဖြစ် ပြပါတယ်။
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.boxplot([[2, 4, 6], [4, 8, 10]], tick_labels=["Store A", "Store B"])
ax.set(ylabel="Units sold")
plt.show()
ပုံဖိုင် ဒေါင်းလုဒ်လုပ်ရန်