Matplotlib တွင် အမှတ်အသားအရွယ်အစားကို ချိန်ညှိနည်း (ဥပမာများနှင့်အတူ)
Matplotlib တွင် အမှတ်အသားအရွယ်အစားကို ချိန်ညှိရန် s အကြောင်းပြချက်ကို အသုံးပြုနိုင်သည်။
plt. scatter (x, y, s= 40 )
အောက်ပါဥပမာများသည် ဤ syntax ကိုလက်တွေ့တွင်မည်သို့အသုံးပြုရမည်ကိုပြသထားသည်။
ဥပမာ 1- အမှတ်အားလုံးအတွက် အမှတ်အသားအရွယ်အစားတစ်ခု သတ်မှတ်ပါ။
အောက်ပါကုဒ်သည် Matplotlib တွင် ခွဲခြမ်းစိပ်ဖြာမှုတစ်ခုကို ဖန်တီးနည်းကို ပြသပြီး ကွက်လပ်ရှိ အမှတ်အားလုံးအတွက် တစ်ခုတည်းသော အမှတ်အသားအရွယ်အစားကို သတ်မှတ်သည်-
import matplotlib. pyplot as plt #define two arrays for plotting A = [3, 5, 5, 6, 7, 8] B = [12, 14, 17, 20, 22, 27] #create scatterplot, specifying marker size to be 40 plt. scatter (A, B, s= 40 )
s အငြင်းအခုံအတွက် ကျွန်ုပ်တို့သတ်မှတ်ထားသော အရေအတွက် ကြီးလေ၊ အမှတ်များ ကွက်ကွက်ထဲတွင် ပိုကြီးလေဖြစ်သည်။
import matplotlib. pyplot as plt #define two arrays for plotting A = [3, 5, 5, 6, 7, 8] B = [12, 14, 17, 20, 22, 27] #create scatterplot, specifying marker size to be 120 plt. scatter (A, B, s= 120 )
ဥပမာ 2- အမှတ်တစ်ခုစီအတွက် မတူညီသော အမှတ်အသားအရွယ်အစားများကို သတ်မှတ်ပါ။
အောက်ပါကုဒ်သည် Matplotlib တွင် ခွဲခြမ်းစိပ်ဖြာမှုတစ်ခုကို ဖန်တီးနည်းကို ပြသပြီး ကွက်လပ်ရှိ အမှတ်တစ်ခုစီအတွက် မတူညီသော အမှတ်အသားအရွယ်အစားကို သတ်မှတ်သည်-
import matplotlib. pyplot as plt #define two arrays for plotting A = [3, 5, 5, 6, 7, 8] B = [12, 14, 17, 20, 22, 27] #define array of marker sizes to use sizes = [20, 40, 60, 80, 100, 150] #create scatterplot, using marker sizes specified in array plt. scatter (A, B, s= sizes )
ဥပမာ 3- အမှတ်အသားအရွယ်အစားများကို သတ်မှတ်ရန် လုပ်ဆောင်ချက်တစ်ခုကို အသုံးပြုပါ။
အောက်ဖော်ပြပါကုဒ်သည် Matplotlib တွင် scatterplot ဖန်တီးနည်းကိုပြသပြီး plot ရှိ အမှတ်တစ်ခုစီအတွက် အသုံးပြုရန် အမှတ်အသားအရွယ်အစားများကို သတ်မှတ်ရန် လုပ်ဆောင်ချက်ကိုအသုံးပြုသည်-
import matplotlib. pyplot as plt #define two arrays for plotting A = [3, 5, 5, 6, 7, 8] B = [12, 14, 17, 20, 22, 27] #define array of marker sizes to use sizes = [3**n for n in range ( len (A))] #create scatterplot, using marker sizes specified in function plt. scatter (A, B, s= sizes )
အမှတ်အသားအရွယ်အစားများကို ချိန်ညှိရန်အတွက် Matplotlib စာရွက်စာတမ်းအပြည့်အစုံကို ဤနေရာတွင် ရှာတွေ့နိုင်ပါသည်။
ထပ်လောင်းအရင်းအမြစ်များ
အောက်ဖော်ပြပါ သင်ခန်းစာများသည် Matplotlib ရှိ အခြားသော ဘုံလုပ်ဆောင်ချက်များကို မည်သို့လုပ်ဆောင်ရမည်ကို ရှင်းပြသည်-
Matplotlib အပိုင်းအစများကို မှတ်သားနည်း
Matplotlib တွင် scatterplot သို့ ဒဏ္ဍာရီထည့်နည်း