Seaborn တွင် pie chart ဖန်တီးနည်း
Seaborn Python ဒေတာအမြင်ပုံဖော်ခြင်းစာကြည့်တိုက်တွင် pie charts များဖန်တီးရန်အတွက် ပုံသေလုပ်ဆောင်ချက်မပါဝင်သော်လည်း၊ သင်သည် pie chart တစ်ခုဖန်တီးရန်နှင့် Seaborn colour palette တစ်ခုထည့်ရန် Matplotlib တွင် အောက်ပါ syntax ကိုအသုံးပြုနိုင်ပါသည်။
import matplotlib. pyplot as plt import seaborn as sns #define data data = [value1, value2, value3, ...] labels = ['label1', 'label2', 'label3', ...] #define Seaborn color palette to use colors = sns. color_palette (' pastel ')[ 0:5 ] #create pie chart plt. pie (data, labels = labels, colors = colors, autopct=' %.0f%% ') plt. show ()
အရောင်စုံ palettes စာရင်းအပြည့်အစုံအတွက် Seaborn စာရွက်စာတမ်း ကို ကိုးကားပါ။
အောက်ပါဥပမာများသည် ဤ syntax ကိုလက်တွေ့တွင်မည်သို့အသုံးပြုရမည်ကိုပြသထားသည်။
ဥပမာ 1- Seaborn Pastel Color Palette ဖြင့် Pie Chart
အောက်ဖော်ပြပါ ကုဒ်သည် Seaborn “ pastel ” ရောင်စုံ palette ကို အသုံးပြု၍ အဝိုင်းပုံဇယားကို ဖန်တီးနည်းကို ပြသသည်-
import matplotlib. pyplot as plt import seaborn as sns #define data data = [15, 25, 25, 30, 5] labels = ['Group 1', 'Group 2', 'Group 3', 'Group 4', 'Group 5'] #define Seaborn color palette to use colors = sns. color_palette (' pastel ')[ 0:5 ] #create pie chart plt. pie (data, labels = labels, colors = colors, autopct=' %.0f%% ') plt. show ()
ဥပမာ 2- Bright Seaborn အရောင်စုံပါသော အဝိုင်းပုံဇယား
အောက်ဖော်ပြပါကုဒ်သည် “ တောက်ပသော ” Seaborn အရောင်စုံကို အသုံးပြု၍ အဝိုင်းပုံဇယားကို ဖန်တီးနည်းကို ပြသသည်-
import matplotlib. pyplot as plt import seaborn as sns #define data data = [15, 25, 25, 30, 5] labels = ['Group 1', 'Group 2', 'Group 3', 'Group 4', 'Group 5'] #define Seaborn color palette to use colors = sns. color_palette (' bright ')[ 0:5 ] #create pie chart plt. pie (data, labels = labels, colors = colors, autopct=' %.0f%% ') plt. show ()
ဤဥပမာနှစ်ခုသည် မတူညီသော Seaborn အရောင် palettes နှစ်ခုဖြင့် pie chart တစ်ခုကို ဖန်တီးပုံကို သရုပ်ဖော်သည်။
သို့သော်၊ သင်သုံးနိုင်သောအခြားစတိုင်များစွာရှိသည်။ ရောင်စုံ palettes စာရင်းအပြည့်အစုံအတွက် အွန်လိုင်းစာရွက်စာတမ်းကို ကိုးကားပါ။
ထပ်လောင်းအရင်းအမြစ်များ
Seaborn တွင် အပူမြေပုံများ ဖန်တီးနည်း
Seaborn တွင် barplots ဖန်တီးနည်း
Seaborn Plots တွင် ခေါင်းစဉ်တစ်ခုထည့်နည်း