Ggplot2 ဒဏ္ဍာရီတွင် ပစ္စည်းများ အစီအစဥ်ပြောင်းနည်း
ggplot2 ဒဏ္ဍာရီတွင် ဒြပ်စင်များ၏ အစီအစဥ်ကို ပြောင်းလဲရန် အောက်ပါ syntax ကို သင် အသုံးပြုနိုင်ပါသည်။
scale_fill_discrete(breaks=c('item4', 'item2', 'item1', 'item3', ...)
အောက်ဖော်ပြပါ ဥပမာသည် ဤ syntax ကို လက်တွေ့တွင် မည်သို့အသုံးပြုရမည်ကို ပြသထားသည်။
ဥပမာ- ggplot2 ဒဏ္ဍာရီရှိ အစိတ်အပိုင်းများ၏ အစီအစဥ်ကို ပြောင်းပါ။
ကွက်ကွက်တစ်ခုတည်းတွင် boxplot အများအပြားကိုပြသသည့် ggplot2 တွင် အောက်ပါကွက်ကွက်ကို ဖန်တီးသည်ဆိုပါစို့။
library (ggplot2) #create data frame df <- data. frame (team=c('A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'VS'), points=c(6, 8, 13, 16, 10, 14, 19, 22, 14, 18, 24, 26)) #create multiple boxplots to visualize points scored by team ggplot(data=df, aes (x=team, y=points, fill=team)) + geom_boxplot()
ဒဏ္ဍာရီပါဒဏ္ဍာရီပါဒြပ်စင်များ၏အစီအစဥ်ကိုပြောင်းလဲရန်၊ ကျွန်ုပ်တို့သည် အောက်ပါအတိုင်း scale_fill_discrete() လုပ်ဆောင်ချက်ကို အသုံးပြုနိုင်ပါသည်။
library (ggplot2) #create data frame df <- data. frame (team=c('A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'VS'), points=c(6, 8, 13, 16, 10, 14, 19, 22, 14, 18, 24, 26)) #create multiple boxplots to visualize points scored by team ggplot(data=df, aes (x=team, y=points, fill=team)) + geom_boxplot() + scale_fill_discrete(breaks=c('B', 'C', 'A'))
ဒြပ်စင်များ၏ အစီအစဥ်သည်- A၊ B၊ C မှ B၊ C၊ A သို့ ပြောင်းသွားသည်ကို သတိပြုပါ။
ဒဏ္ဍာရီဒြပ်စင်များအတွက် အသုံးပြုသည့် သီးခြားတံဆိပ်များကို မွမ်းမံပြင်ဆင်ရန် အညွှန်းများ အကြောင်းပြချက်များကိုလည်း အသုံးပြုနိုင်ပါသည်။
library (ggplot2) #create data frame df <- data. frame (team=c('A', 'A', 'A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'VS'), points=c(6, 8, 13, 16, 10, 14, 19, 22, 14, 18, 24, 26)) #create multiple boxplots to visualize points scored by team ggplot(data=df, aes (x=team, y=points, fill=team)) + geom_boxplot() + scale_fill_discrete(breaks=c('B', 'C', 'A'), labels=c('B Team', 'C Team', 'A Team'))
ဒဏ္ဍာရီအညွှန်းများ ပြောင်းလဲသွားသည်ကို သတိပြုပါ။
ထပ်လောင်းအရင်းအမြစ်များ
အောက်ဖော်ပြပါ သင်ခန်းစာများသည် ggplot2 တွင် အခြားဘုံလုပ်ဆောင်ချက်များကို မည်သို့လုပ်ဆောင်ရမည်ကို ရှင်းပြသည်-
ggplot2 တွင်ဒဏ္ဍာရီကိုမည်သို့ဖယ်ရှားနည်း
ggplot2 တွင် ဒဏ္ဍာရီ အနေအထားကို ဘယ်လိုပြောင်းမလဲ။
ggplot2 တွင် ဒဏ္ဍာရီအရွယ်အစားကို မည်သို့ပြောင်းလဲမည်နည်း။
ggplot2 တွင်ဒဏ္ဍာရီခေါင်းစဉ်ကိုဘယ်လိုပြောင်းမလဲ။