Heatmaps နှင့် Colorbars
3.11.2
Numeric matrix ကို ပြပြီး တန်ဖိုးတွေ ဘယ်အရောင်နဲ့ ကိုက်လဲ ဖော်ပြပါ။
ဒီစာမျက်နှာမှာ
Matrix ကို Pixel တွေနဲ့ ကိုယ်စားပြုခြင်း
imshow က ပုံစံညီတဲ့ matrix ကို image အဖြစ် ပြပါတယ်။ Scale ပြဖို့ colorbar ထည့်ပါ။ Row၊ column အဓိပ္ပာယ် မပျောက်ဖို့ axis နှစ်ခုလုံး label ထည့်ပါ။
import matplotlib.pyplot as plt
fig, ax = plt.subplots(layout="constrained")
image = ax.imshow([[4, 7, 5], [8, 6, 3]], cmap="viridis", vmin=0, vmax=10)
ax.set_xticks([0, 1, 2], ["Mon", "Tue", "Wed"])
ax.set_yticks([0, 1], ["Store A", "Store B"])
fig.colorbar(image, ax=ax, label="Units")
plt.show()
ပုံဖိုင် ဒေါင်းလုဒ်လုပ်ရန်
နှိုင်းယှဉ်ရာမှာ Scale တူတူ သုံးခြင်း
ယှဉ်မယ့် heatmap တွေမှာ normalization တူတူ ဒါမှမဟုတ် vmin၊ vmax တူတူ လိုပါတယ်။ အရေးပါတဲ့ midpoint ရဲ့ ဘက်နှစ်ဘက်က ကွာဟချက်တွေ ပြချင်ရင် diverging scale ရွေးပါ။