Point များ မှတ်သား၍ Tick ပုံစံချခြင်း
3.11.2
အရေးပါတဲ့ point ကို ထင်ရှားအောင် ပြပြီး chart data ကို မပြောင်းဘဲ label ပုံစံချပါ။
ဒီစာမျက်နှာမှာ
အရေးပါတဲ့ Observation ကို ညွှန်းခြင်း
annotate မှာ data point xy နဲ့ စာသားနေရာ xytext သီးခြား သတ်မှတ်နိုင်ပါတယ်။ Axis limit ပြောင်းရင်လည်း point နားမှာ label တိုတို ထားဖို့ offset points သုံးပါ။
import matplotlib.pyplot as plt
from matplotlib.ticker import PercentFormatter
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [0.18, 0.22, 0.20], marker="o")
ax.annotate("Peak", xy=(2, 0.22), xytext=(10, -14), textcoords="offset points")
ax.yaxis.set_major_formatter(PercentFormatter(xmax=1))
ax.set(xlabel="Week", ylabel="Conversion")
plt.show()
ပုံဖိုင် ဒေါင်းလုဒ်လုပ်ရန်
Tick နေရာနဲ့ ပုံစံ သီးခြား ထားခြင်း
Tick locator က နေရာ ရွေးပြီး formatter က တန်ဖိုးကို ပြမယ့်စာသား ပြောင်းပေးပါတယ်။ သုညကနေ တစ်အတွင်း proportion အတွက် PercentFormatter(xmax=1) က 0.22 ကို 22 ရာခိုင်နှုန်းအဖြစ် ပြပါတယ်။