R တွင် ဇာတ်ကွက်တစ်ခု၏ အပြင်ဘက်တွင် ဒဏ္ဍာရီကို မည်သို့ဆွဲမည်နည်း။


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

 by( mar =c(5, 4, 4, 8), xpd= TRUE )

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

အဆင့် 1: ဒေတာကိုဖန်တီးပါ။

ဦးစွာ၊ ဒေတာအချို့ကို ဖန်တီးကြပါစို့-

 #create data frames
df1 <- data. frame (x=c(1, 2, 3, 4, 5, 6, 7),
                  y=c(2, 7, 19, 26, 24, 29, 31))

df2 <- data. frame (x=c(1, 2, 3, 4, 5, 6, 7),
                  y=c(4, 4, 7, 9, 12, 13, 8))

အဆင့် 2- ဇာတ်လမ်းအပြင်ဘက်တွင် ဒဏ္ဍာရီတစ်ခုဖြင့် ဇာတ်ကွက်တစ်ခုကို ဖန်တီးပါ။

ထို့နောက်၊ လမ်းကြောင်းတစ်ခုဖန်တီးပြီး ညာဘက်အပေါ်ထောင့်ရှိ လမ်းကြောင်းအပြင်ဘက်တွင် ဒဏ္ဍာရီတစ်ခုကို ထည့်ကြပါစို့။

 #add extra space to the right of the plot
by( mar =c(5, 4, 4, 8), xpd= TRUE )

#plot both data frames
plot(y ~ x, df1, pch =1, main=" Scatterplot with multiple groups ")
points(y ~ x, df2, pch =3)

#add legend outside of plot
legend(" topright ", inset =c(-0.2, 0), legend =c(" df1 "," df2 "), pch =c(1,3), title =" Data ") 

R အခြေခံဇာတ်ကွက်၏ အပြင်ဘက် ဒဏ္ဍာရီ

အဆင့် 3- ဒဏ္ဍာရီတည်နေရာကိုပြောင်းပါ။

inset(x, y) argument ကို ဇာတ်ကွက်၏ညာဘက်ရှိ ဒဏ္ဍာရီ၏တည်နေရာကို ထိန်းချုပ်ရန် အသုံးပြုနိုင်သည်။ ဥပမာအားဖြင့်၊ ကျွန်ုပ်တို့သည် ဒဏ္ဍာရီကို ညာဘက်သို့ပို၍တွန်းပို့ရန် အငြင်းအခုံ x ပိုအနုတ်လက္ခဏာကို ပြုလုပ်နိုင်သည်-

 #add extra space to the right of the plot
by( mar =c(5, 4, 4, 8), xpd= TRUE )

#plot both data frames
plot(y ~ x, df1, pch =1, main=" Scatterplot with multiple groups ")
points(y ~ x, df2, pch =3)

#add legend outside of plot
legend(" topright ", inset =c(-0.3, 0), legend =c(" df1 "," df2 "), pch =c(1,3), title =" Data ") 

R တွင် မြေကွက်အပြင်ဘက် ဒဏ္ဍာရီ၏တည်နေရာ

ဒဏ္ဍာရီကို နိမ့်ကျအောင် တွန်းပို့ရန် y အငြင်းအခုံကို ပိုကောင်းအောင် လုပ်နိုင်သည်။

 #add extra space to the right of the plot
by( mar =c(5, 4, 4, 8), xpd= TRUE )

#plot both data frames
plot(y ~ x, df1, pch =1, main=" Scatterplot with multiple groups ")
points(y ~ x, df2, pch =3)

#add legend outside of plot
legend(" topright ", inset =c(-0.3, .5), legend =c(" df1 "," df2 "), pch =c(1,3), title =" Data ") 

ညာဘက်ရှိ ကွက်အပြင်ဘက်တွင် ဒဏ္ဍာရီပါသော R တွင် အခြေခံဇာတ်ကွက်

ဒဏ္ဍာရီ၏တည်နေရာကိုပြောင်းလဲရန် inset(x, y) အငြင်းအခုံ၏တန်ဖိုးများကိုမွမ်းမံပြင်ဆင်ပါ။

နောက်ထပ် R သင်ခန်းစာများကို ဤစာမျက်နှာတွင် သင်တွေ့နိုင်ပါသည်။

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

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