Seaborn တွင် area chart ဖန်တီးနည်း (ဥပမာများနှင့်အတူ)


seaborn တွင် ဧရိယာဇယားတစ်ခုဖန်တီးရန် အောက်ပါအခြေခံအထားအသိုကိုသုံးနိုင်သည်။

 import matplotlib. pyplot as plt
import seaborn as sns

#set seaborn style
sns. set_theme ()

#create seaborn area chart
plt. stackplot ( df.x , df.y1 , df.y2 , df.y3 )

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

ဥပမာ 1- Seaborn တွင် အခြေခံဧရိယာဇယားကို ဖန်တီးပါ။

အောက်ဖော်ပြပါကုဒ်သည် Seaborn တွင် အခြေခံဧရိယာဇယားကို ဖန်တီးနည်းကို ပြသသည်-

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

#set seaborn style
sns. set_theme ()
 
#define DataFrame
df = pd. DataFrame ({' period ': [1, 2, 3, 4, 5, 6, 7, 8],
                   ' team_A ': [20, 12, 15, 14, 19, 23, 25, 29],
                   ' team_B ': [5, 7, 7, 9, 12, 9, 9, 4],
                   ' team_C ': [11, 8, 10, 6, 6, 5, 9, 12]})

#create area chart
plt. stackplot (df. period , df. team_A , df. team_B , df. team_C )

x-axis သည် period variable ကိုပြသပြီး y-axis သည် အချိန်နှင့်အမျှ အဖွဲ့သုံးဖွဲ့စီအတွက် တန်ဖိုးများကို ပြသသည်။

ဥပမာ 2- Seaborn တွင် စိတ်ကြိုက်ဧရိယာဇယားကို ဖန်တီးပါ။

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

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

#set seaborn style
sns. set_theme ()
 
#define DataFrame
df = pd. DataFrame ({' period ': [1, 2, 3, 4, 5, 6, 7, 8],
                   ' team_A ': [20, 12, 15, 14, 19, 23, 25, 29],
                   ' team_B ': [5, 7, 7, 9, 12, 9, 9, 4],
                   ' team_C ': [11, 8, 10, 6, 6, 5, 9, 12]})

#define colors to use in chart
color_map = [' red ', ' steelblue ', ' pink ']
    
#create area chart
plt. stackplot (df. period , df. team_A , df. team_B , df. team_C ,
              labels=[' Team A ', ' Team B ', ' Team C '],
              colors=color_map)

#add legend
plt. legend (loc=' upper left ')

#add axis labels
plt. xlabel (' Period ')
plt. ylabel (' Points Scored ')

#display area chart
plt. show () 

အရောင် အငြင်းအခုံများသည် အရောင်အမည်များအပြင် ဆယ်ဂဏန်းဂဏန်းရောင်ကုဒ်များကို လက်ခံကြောင်း သတိပြုပါ။

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

အောက်ဖော်ပြပါ သင်ခန်းစာများသည် Seaborn တွင် အခြားဘုံကွက်များကို ဖန်တီးနည်းကို ရှင်းပြသည်-

Seaborn တွင် Time Series Plot တစ်ခုဖန်တီးနည်း
Seaborn တွင် Pie Chart ဖန်တီးနည်း
Seaborn တွင် barplot ဖန်တီးနည်း

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

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