Ggplot2 တွင် ဝင်ရိုးအစီစဥ်ပြောင်းနည်း (ဥပမာများနှင့်အတူ)
ggplot2 တွင် ဝင်ရိုးတစ်ခု၏အစီအစဥ်ကို လျင်မြန်စွာပြောင်းပြန်လှန်ရန် scale_y_reverse() နှင့် scale_x_reverse() လုပ်ဆောင်ချက်များကို သင်အသုံးပြုနိုင်ပါသည်။
ဤလုပ်ဆောင်ချက်များသည် အောက်ပါအခြေခံ syntax ကိုအသုံးပြုသည်-
ggplot(df, aes(x, y)) + geom_point() + scale_y_reverse()
ဝင်ရိုးကိုလှန်ပြီးနောက် ဝင်ရိုးကန့်သတ်ချက်အသစ်များကို သတ်မှတ်ရန် ဤလုပ်ဆောင်ချက်များနှင့် ကန့်သတ် အငြင်းပွားမှုကိုလည်း သင်အသုံးပြုနိုင်သည်-
ggplot(df, aes(x, y)) + geom_point() + scale_y_reverse (limits=c( 100,50 ))
အောက်ဖော်ပြပါ ဥပမာသည် ဤလုပ်ဆောင်ချက်များကို လက်တွေ့အသုံးချနည်းကို ပြသထားသည်။
ဥပမာ- ggplot2 ရှိ ပုဆိန်၏ ပြောင်းပြန်အစီအမံ
အောက်ပါကုဒ်သည် ပုံမှန်ဝင်ရိုးဖြင့် ggplot2 တွင် scatterplot ဖန်တီးနည်းကို ပြသသည်-
library (ggplot2)
#create data frame
df <- data. frame (hours=c(1, 2, 2, 3, 4, 6, 7, 7, 8, 9),
score=c(76, 77, 75, 79, 84, 88, 85, 94, 95, 90))
#create scatter plot with normal y-axis
ggplot(df, aes(x=hours, y=score)) +
geom_point(size= 2 )
လက်ရှိ y ဝင်ရိုးသည် 75 မှ 95 သို့သွားသည်ကို သတိပြုပါ။
အောက်ပါ ကုဒ်သည် y ဝင်ရိုးပေါ်ရှိ တန်ဖိုးများကို ပြောင်းပြန်လှန်ရန် scale_y_reverse() လုပ်ဆောင်ချက်ကို အသုံးပြုပုံကို ပြသသည်-
library (ggplot2)
#create data frame
df <- data. frame (hours=c(1, 2, 2, 3, 4, 6, 7, 7, 8, 9),
score=c(76, 77, 75, 79, 84, 88, 85, 94, 95, 90))
#create scatter plot with reversed y-axis
ggplot(df, aes(x=hours, y=score)) +
geom_point(size= 2 ) +
scale_y_reverse()
ယခု y ဝင်ရိုးသည် 95 မှ 75 သို့သွားသည်ကို သတိပြုပါ။
y-axis ကန့်သတ်ချက်များကို ပြောင်းလဲရန် scale_y_reverse() လုပ်ဆောင်ချက်ရှိ က န့်သတ် အငြင်းအခုံများကိုလည်း အသုံးပြုနိုင်သည်။
library (ggplot2)
#create data frame
df <- data. frame (hours=c(1, 2, 2, 3, 4, 6, 7, 7, 8, 9),
score=c(76, 77, 75, 79, 84, 88, 85, 94, 95, 90))
#create scatter plot with reversed y-axis and modified limits
ggplot(df, aes(x=hours, y=score)) +
geom_point(size= 2 ) +
scale_y_reverse (limits=c( 100,50 ))
ယခု y ဝင်ရိုးသည် 100 မှ 50 သို့သွားသည်ကို သတိပြုပါ။
ထပ်လောင်းအရင်းအမြစ်များ
အောက်ဖော်ပြပါ သင်ခန်းစာများသည် ggplot2 တွင် အခြားဘုံအလုပ်များကို မည်သို့လုပ်ဆောင်ရမည်ကို ရှင်းပြသည်-
ggplot2 တွင် ဝင်ရိုးတံဆိပ်များကို လှည့်နည်း
ggplot2 တွင် ဝင်ရိုးကွဲများကို သတ်မှတ်နည်း
ggplot2 တွင် ဝင်ရိုးကန့်သတ်ချက်များကို မည်သို့သတ်မှတ်မည်နည်း။
ggplot2 တွင် ဒဏ္ဍာရီအညွှန်းများကို မည်သို့ပြောင်းရမည်နည်း။