Matplotlib တွင် axes များကို ဝှက်နည်း (ဥပမာများနှင့်အတူ)


Matplotlib ကွက်များတွင် axes များကို ဝှက်ထားရန် အောက်ပါ syntax ကို သင်သုံးနိုင်သည်။

 import matplotlib. pyplot as plt

#get current axes
ax = plt. gca ()

#hide x-axis
ax. get_xaxis (). set_visible ( False )

#hide y-axis 
ax. get_yaxis (). set_visible ( False )

အောက်ဖော်ပြပါ ဥပမာများသည် ဤ syntax ကို လက်တွေ့တွင် မည်သို့အသုံးပြုရမည်ကို ပြသထားသည်။

ဥပမာ 1- X ဝင်ရိုးကို ဝှက်ပါ။

အောက်ပါကုဒ်သည် scatterplot တစ်ခုကိုဖန်တီးပြီး x-axis ကို ဖျောက်နည်းကို ပြသည်-

 import matplotlib. pyplot as plt

#define data
x = [3, 4, 4, 6, 7, 8, 8, 12]
y = [11, 12, 12, 14, 17, 15, 14, 19]

#create scatterplot
plt. scatter (x,y)

#get current axes
ax = plt. gca ()

#hide x-axis
ax. get_xaxis (). set_visible ( False )

Matplotlib တွင် x-axis ကိုဝှက်ထားပါ။

ဥပမာ 2- Y ဝင်ရိုးကို ဝှက်ပါ။

အောက်ပါကုဒ်သည် ခွဲခြမ်းစိပ်ဖြာပုံဖန်တီးနည်းနှင့် Y ဝင်ရိုးကို ဝှက်ထားပုံကို ပြသသည်-

 import matplotlib. pyplot as plt

#define data
x = [3, 4, 4, 6, 7, 8, 8, 12]
y = [11, 12, 12, 14, 17, 15, 14, 19]

#create scatterplot
plt. scatter (x,y)

#get current axes
ax = plt. gca ()

#hide y-axis
ax. get_yaxis (). set_visible ( False ) 

ဥပမာ 3- axes နှစ်ခုလုံးကို ဝှက်ထားပါ။

အောက်ပါကုဒ်သည် scatterplot နှစ်ခုလုံးကို ဖန်တီးပြီး axes ကို ဝှက်နည်းကို ပြသသည်-

 import matplotlib. pyplot as plt

#define data
x = [3, 4, 4, 6, 7, 8, 8, 12]
y = [11, 12, 12, 14, 17, 15, 14, 19]

#create scatterplot
plt. scatter (x,y)

#get current axes
ax = plt. gca ()

#hide x-axis
ax. get_xaxis (). set_visible ( False )

#hide y-axis
ax. get_yaxis (). set_visible ( False )

ဥပမာ 4- ပုဆိန်နှင့် ဘောင်များကို လုံးဝဖယ်ရှားပါ။

အောက်ဖော်ပြပါ ကုဒ်သည် ကွက်ကွက်မှ ပုဆိန်နှင့် ဘောင်များကို မည်ကဲ့သို့ ဖယ်ရှားရမည်ကို ပြသသည်-

 import matplotlib. pyplot as plt

#define data
x = [3, 4, 4, 6, 7, 8, 8, 12]
y = [11, 12, 12, 14, 17, 15, 14, 19]

#create scatterplot
plt. scatter (x,y)

#get current axes
ax = plt. gca ()

#hide axes and borders
plt. axis (' off ')

ထပ်လောင်းအရင်းအမြစ်များ

Matplotlib ရှိ tick အရေအတွက်ကို ဘယ်လိုပြောင်းမလဲ။
Matplotlib ရှိ အမှတ်အသားတံဆိပ်များကို လှည့်နည်း
Matplotlib တွင် ဝင်ရိုးအပိုင်းအခြားများ သတ်မှတ်နည်း

မှတ်ချက်တစ်ခုထည့်ပါ။

သင့် email လိပ်စာကို ဖော်ပြမည် မဟုတ်ပါ။ လိုအပ်သော ကွက်လပ်များကို * ဖြင့်မှတ်သားထားသည်