ဒဏ္ဍာရီကို ပင်လယ်မွေးဇာတ်ကွက်၏ အပြင်ဘက်တွင် ထားနည်း (ဥပမာများနှင့်အတူ)


ပင်လယ်ဒဏ္ဍာရီကို ဇာတ်ကွက်အပြင်ဘက်တွင် နေရာချရန် bbox_to_anchor() အငြင်းအခုံကို အသုံးပြုနိုင်သည်။

ဥပမာအားဖြင့်၊ ဇာတ်ကွက်၏အပြင်ဘက်တွင် ဒဏ္ဍာရီကို ညာဘက်အပေါ်ထောင့်တွင် နေရာချရန် အောက်ပါအထားအသိုကို အသုံးပြုနိုင်သည်။

 plt. legend (bbox_to_anchor=( 1.05 , 1 ), loc=' upper left ', borderaxespad= 0 )

သြဒိနိတ်များ (1.05၊ 1) သည် ဒဏ္ဍာရီကို ထားရှိသင့်သည့် (x, y) သြဒိနိတ်များနှင့် သက်ဆိုင်ကြောင်း သတိပြုရန်နှင့် borderaxespad သည် axes နှင့် border legend အကြား padding ကို သတ်မှတ်ပေးသည်။

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

ဥပမာ- ဒဏ္ဍာရီကို Seaborn ဇာတ်ကွက်အပြင်ဘက်မှာထားပါ။

အောက်ဖော်ပြပါ ကုဒ်သည် ဒဏ္ဍာရီကို အဏ္ဏဝါဇာတ်ကွက်တစ်ခု၏ အပေါ်ဘက်ညာဘက်ထောင့်အပြင်ဘက်တွင် မည်သို့ထားရမည်ကို ပြသသည်-

 import pandas as pd
import seaborn as sns
import matplotlib. pyplot as plt

#create fake data
df = pd. DataFrame ({' points ': [25, 12, 15, 14, 19, 23, 25, 29],
                   ' assists ': [5, 7, 7, 9, 12, 9, 9, 4],
                   ' team ': ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B']})

#create scatterplot
sns. scatterplot (data=df, x=' points ', y=' assists ', hue=' team ')

#place legend outside top right corner of plot
plt. legend (bbox_to_anchor=( 1.02 , 1 ), loc=' upper left ', borderaxespad= 0 ) 

ဤနေရာတွင် ဒဏ္ဍာရီကို ဇာတ်ကွက်၏ ညာဘက်ဗဟိုဘောင်အပြင်ဘက်တွင် မည်သို့ထားရမည်နည်း၊

 #create scatterplot
sns. scatterplot (data=df, x=' points ', y=' assists ', hue=' team ')

#place legend outside center right border of plot
plt. legend (bbox_to_anchor=( 1.02 , 0.55 ), loc=' upper left ', borderaxespad= 0 ) 

Seaborn ဒဏ္ဍာရီဇာတ်ကွက်အပြင်

ဤသည်မှာ ဒဏ္ဍာရီကို ဇာတ်ကွက်၏အောက်ခြေညာဘက်ထောင့်အပြင်ဘက်တွင် မည်သို့ထားရှိရမည်နည်း၊

 #create scatterplot
sns. scatterplot (data=df, x=' points ', y=' assists ', hue=' team ')

#place legend outside bottom right corner of plot
plt. legend (bbox_to_anchor=( 1.02 , 0.15 ), loc=' upper left ', borderaxespad= 0 ) 

bbox_to_anchor() အငြင်းအခုံ၏အသေးစိတ်ရှင်းပြချက်အတွက် matplotlib စာရွက်စာတမ်းကို ကိုးကားပါ။

ဇာတ်ကွက်ဗေဒကို ဘယ်လိုပုံစံလုပ်ရမယ်ဆိုတဲ့ အသေးစိတ်အတွက် Seaborn documentation ကို ကြည့်ပါ။

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

Seaborn ဇာတ်ကွက်၏ ပုံအရွယ်အစားကို ချိန်ညှိနည်း
Seaborn ကွက်တွင် ဝင်ရိုးအညွှန်းများကို မည်သို့ပြောင်းရမည်နည်း။
Seaborn ဇာတ်ကွက်တွင် ဒဏ္ဍာရီဖောင့်အရွယ်အစားကို မည်သို့ပြောင်းလဲမည်နည်း။

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

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