မေးခွန်းနဲ့ ကိုက်တဲ့ Chart ရွေးခြင်း
3.11.2
Category၊ trend၊ distribution နဲ့ ဆက်နွှယ်မှုတွေကို ဘယ် chart နဲ့ ပြမလဲ ရွေးပါ။
ဒီစာမျက်နှာမှာ
Category များ ယှဉ်ခြင်းနှင့် အချိန်အလိုက် ပြောင်းလဲမှု ပြခြင်း
သီးခြား category တွေ ယှဉ်ဖို့ bar chart သုံးပါ။ တန်ဖိုးပမာဏကို bar အရှည်နဲ့ ပြတဲ့အတွက် axis ကို သုညကနေ စပါ။ အချိန်လို အစဉ်လိုက်ကြည့်ရတဲ့ data အတွက် line chart သုံးပါ။ ရက်စွဲတွေ အညီအမျှ မခြားရင် ရက်စွဲတန်ဖိုးအတိုင်း ဆွဲမှ အကွာအဝေးက ကြားကာလကို ကိုယ်စားပြုပါမယ်။
import matplotlib.pyplot as plt
fig, (by_store, by_month) = plt.subplots(1, 2, layout="constrained")
bars = by_store.bar(["A", "B", "C"], [8, 12, 6])
by_store.bar_label(bars)
by_store.set(ylim=(0, 14), xlabel="Store", ylabel="Orders")
by_month.plot(["Jan", "Feb", "Mar"], [20, 24, 22], marker="o")
by_month.set(xlabel="Month", ylabel="Orders")
plt.show()
ပုံဖိုင် ဒေါင်းလုဒ်လုပ်ရန်
Distribution သို့မဟုတ် ဆက်နွှယ်မှု ပြခြင်း
Histogram က ကိန်းဂဏန်း column တစ်ခုရဲ့ တန်ဖိုးတွေကို range အလိုက် စုပါတယ်။ Bin အကျယ် ပြောင်းပြီး မြင်ရတဲ့ pattern တည်ငြိမ်လား စစ်ပါ။ Scatter plot မှာ observation တစ်ခုစီကို ကိန်းဂဏန်းနှစ်ခုက သတ်မှတ်တဲ့ နေရာမှာ အမှတ်တစ်ခုနဲ့ ပြပါတယ်။ Pattern ကို အဓိပ္ပာယ်မဖော်ခင် အမှတ်ထပ်နေတာ၊ ထူးခြားတဲ့ အမှတ်နဲ့ အုပ်စုခွဲတွေ ရှိမရှိ ကြည့်ပါ။
import matplotlib.pyplot as plt
fig, (histogram, scatter) = plt.subplots(1, 2, layout="constrained")
durations = [12, 16, 17, 22, 24, 28, 33, 35]
histogram.hist(durations, bins=[10, 20, 30, 40], edgecolor="white")
histogram.set(xlabel="Duration (min)", ylabel="Deliveries")
distance = [1, 2, 2.5, 3, 4, 5, 5.5, 6]
scatter.scatter(distance, durations)
scatter.set(xlabel="Distance (km)", ylabel="Duration (min)")
plt.show()
ပုံဖိုင် ဒေါင်းလုဒ်လုပ်ရန်