problem in y axis in barplot+ggplot

problem in y axis in barplot+ggplot

1

Hi every body

I want to plot barplot using ggplot.
my data is:

     X1         X2
  2367   تولید کل
    23    هندوانه
    11       خیار
    97       گوجه
     0        سیب
   107       پیاز
     2       کلزا
     0       سویا
     2 آفتابگردان
  748   چغندرقند
    0       پنبه
   22       نخود
    6        عدس
   29      لوبیا
    0        ذرت
    0       برنج
  162         جو
 1152       گندم

I used the following code:

ggplot(data=df, aes(x=X2,y=X1)) +
  geom_bar(stat="identity", fill="steelblue")+
  geom_text(aes(label=X1), vjust=1.6, color="white", size=2)+
  theme_minimal()

and the result is:

enter image description here

the y axis scale is not right. how can I make it right?


barplot


ggplot

• 21 views

Read more here: Source link