R Pie Charts


စက်ဝိုင်းပုံများ

စက်ဝိုင်းပုံဇယားသည် ဒေတာ၏ စက်ဝိုင်းပုံဂရပ်ဖစ်မြင်ကွင်းတစ်ခုဖြစ်သည်။

pie()အဝိုင်းဇယားများရေးဆွဲရန် လုပ်ဆောင်ချက်ကို အသုံးပြု ပါ-

ဥပမာ

# Create a vector of pies
x <- c(10,20,30,40)

# Display the pie chart
pie(x)

ရလဒ်:

နမူနာရှင်းပြထားပါတယ်။

သင်တွေ့မြင်ရသည့်အတိုင်း ပုံဇယားသည် vector ရှိတန်ဖိုးတစ်ခုစီအတွက် pie တစ်ခုစီဆွဲသည် (ဤကိစ္စတွင် 10၊ 20၊ 30၊ 40)။

ပုံသေအားဖြင့်၊ ပထမအဝိုင်း၏ကွက်ကွက်သည် x-axis မှစတင်ပြီး နာရီလက်တံအတိုင်း ပြန် ရွှေ့သည် ။

မှတ်ချက်- ဤဖော်မြူလာကိုအသုံးပြုခြင်းဖြင့် pie တစ်ခုစီ၏ အရွယ်အစားသည် တန်ဖိုးအားလုံးကို အခြားတန်ဖိုးများနှင့် နှိုင်းယှဉ်ခြင်းဖြင့် ဆုံးဖြတ်သည်-

တန်ဖိုးအားလုံး၏ ပေါင်းလဒ်ဖြင့် ပိုင်းခြားထားသော တန်ဖိုး- x/sum(x)


Start Angle

အဝိုင်းဇယား၏ အစထောင့်ကို ပါရာမီတာဖြင့် ပြောင်းလဲနိုင်သည် init.angle

ပုံသေထောင့်သည် 0 ဖြစ်ပြီး၊ ၏တန်ဖိုးကို init.angleဒီဂရီဖြင့် သတ်မှတ်သည်။

ဥပမာ

ပထမအဝိုင်းကို 90 ဒီဂရီတွင် စတင်ပါ။

# Create a vector of pies
x <- c(10,20,30,40)

# Display the pie chart and start the first pie at 90 degrees
pie(x, init.angle = 90)

ရလဒ်:


အညွှန်းများနှင့် ခေါင်းစီး

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

ဥပမာ

# Create a vector of pies
x <- c(10,20,30,40)

# Create a vector of labels
mylabel <- c("Apples", "Bananas", "Cherries", "Dates")

# Display the pie chart with labels
pie(x, label = mylabel, main = "Fruits")

ရလဒ်:


အရောင်များ

ဘောင်တစ်ခုစီတွင် အရောင်တစ်ခုစီကို သင်ထည့်သွင်းနိုင်သည် col-

ဥပမာ

# Create a vector of colors
colors <- c("blue", "yellow", "green", "black")

# Display the pie chart with colors
pie(x, label = mylabel, main = "Fruits", col = colors)

ရလဒ်:


ဒဏ္ဍာရီ

အဝိုင်းတစ်ခုစီအတွက် ရှင်းလင်းချက်စာရင်းကို ထည့်ရန်၊ legend()လုပ်ဆောင်ချက်ကို အသုံးပြုပါ-

ဥပမာ

# Create a vector of labels
mylabel <- c("Apples", "Bananas", "Cherries", "Dates")

# Create a vector of colors
colors <- c("blue", "yellow", "green", "black")

# Display the pie chart with colors
pie(x, label = mylabel, main = "Pie Chart", col = colors)

# Display the explanation box
legend("bottomright", mylabel, fill = colors)

ရလဒ်:

ဒဏ္ဍာရီကို လည်းကောင်း နေရာချထားနိုင်သည်-

bottomright, bottom, bottomleft, left, topleft, top, topright, right, center