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


ggplot2 ဒဏ္ဍာရီ၏ အနေအထားကို သတ်မှတ်ရန် အောက်ပါ syntax ကို သင်သုံးနိုင်သည်။

 theme(legend.position = " right ")

အောက်ဖော်ပြပါနမူနာများသည် R တွင်ပါရှိသော iris dataset နှင့် လက်တွေ့တွင် ဤ syntax ကို မည်သို့အသုံးပြုရမည်ကို ပြသထားသည်။

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

ဒဏ္ဍာရီကို ဇာတ်ကွက်၏ “ ထိပ်” ၊ “ ညာ” ၊ “ အောက်ခြေ” သို့မဟုတ် “ ဘယ်ဘက်” တွင် ggplot2 ကို တိုက်ရိုက်ပြောနိုင်သည်။

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

 library (ggplot2)

ggplot(iris, aes (x=Sepal.Length, y=Sepal.Width, color=Species)) +
       geom_point() +
       theme(legend.position = “ top ”) 

ကွက်ကွက်၏ထိပ်ရှိ ggplot2 ခေါင်းစဉ်၏ဥပမာ

ပြီးတော့ ဒီဇာတ်လမ်းရဲ့ အောက်ခြေမှာ ဒဏ္ဍာရီကို ဘယ်လိုထားရမလဲဆိုတာကတော့၊

 library (ggplot2)

ggplot(iris, aes (x=Sepal.Length, y=Sepal.Width, color=Species)) +
       geom_point() +
       theme(legend.position = “ bottom ”) 

ggplot2 ၏အောက်ခြေရှိ ခေါင်းစဉ်ဥပမာ

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

ဇာတ်ကွက်အတွင်း ဒဏ္ဍာရီကို နေရာချရန် အတိအကျ သြဒိနိတ်များ (x,y) ကိုလည်း သတ်မှတ်နိုင်သည်။

ဥပမာအားဖြင့်၊ ဤနေရာတွင် စာတန်းကို ညာဘက်အပေါ်ထောင့်တွင် မည်သို့ထားရမည်နည်း။

 library (ggplot2)

ggplot(iris, aes (x=Sepal.Length, y=Sepal.Width, color=Species)) +
       geom_point() +
       theme(legend.position = c( .9 , .9 )) 

ဒီမှာ ဒဏ္ဍာရီကို ညာဘက်အောက်ထောင့်မှာ ဘယ်လိုထားရမလဲ။

 library (ggplot2)

ggplot(iris, aes (x=Sepal.Length, y=Sepal.Width, color=Species)) +
       geom_point() +
       theme(legend.position = c( .9 , .1 )) 

ဥပမာ- ဒဏ္ဍာရီကို လုံးဝဖျက်ပစ်ပါ။

Legend.position=”none” ကို အောက်ပါအတိုင်း သတ်မှတ်ခြင်းဖြင့် ggplot2 တွင် ဇာတ်ကွက်တစ်ခုမှ ဒဏ္ဍာရီကို ဖယ်ရှားနိုင်သည်။

 library (ggplot2)

ggplot(iris, aes (x=Sepal.Length, y=Sepal.Width, color=Species)) +
       geom_point() +
       theme(legend.position = " none ") 

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

ggplot2 တွင် ဒဏ္ဍာရီအရွယ်အစားကို မည်သို့ပြောင်းလဲမည်နည်း။
ggplot2 တွင်ဒဏ္ဍာရီခေါင်းစဉ်ကိုဘယ်လိုပြောင်းမလဲ။
အကောင်းဆုံး ggplot2 အပြင်အဆင်များအတွက် ပြီးပြည့်စုံသော လမ်းညွှန်

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

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