I am trying to name the boxplots of different groups in my graph using ggplot:
`ggplot(data, aes(y=Values, group= Groups, x=Groups)) +
  stat_boxplot(geom= "errorbar", width= 0.5) +
  geom_boxplot(fill=c("skyblue2", "gold2"), outlier.color = "black", alpha = 1) +
  labs(x="Different groups", y="Frequency", title="Groups in comparison")+
  theme_minimal()+
  theme(axis.title.x = element_text(size =10))+
  theme(axis.title.y = element_text(size =10))+
  theme(plot.title=element_text(size = 16))+
  theme(plot.title = element_text(hjust = 0.5))+
  theme(plot.title = element_text(vjust = 2.8))+
  #scale_x_discrete(labels = c("Group A", "Group B"))+ #<- Code in question
  #xlim(labels= c("Group A","Group B")) + #<- Code in question
  stat_summary(fun = mean, geom = "errorbar", aes(ymax = ..y.., ymin = ..y..),
                width = .75, linetype = "dashed", col = "red")`
First I tried with  scale_x_discrete(labels = c("Group A", "Group B")), however even though a graph is calculated still no labels for the graphs are displayed:
Secondly, I tried using xlim(labels = c("Group A","Group B")), which gave me the unsatisfying result that can be seen here:
 Besides, I don't understand why the boxplots appear more slender in the first image.
Besides, I don't understand why the boxplots appear more slender in the first image.
Here's an example of my data:
                        Values     Groups  ID
1                     1.466667          0 FM1
2                     2.666667          1 FM1
3                     1.133333          1 FM1
4                     1.800000          1 FM1
5                     1.866667          1 FM1
6                     2.133333          1 FM1
7                     2.466667          0 FM2
8                     1.666667          1 FM2
9                     2.600000          1 FM2
10                    1.800000          1 FM2
11                    1.266667          1 FM2
12                    1.066667          1 FM2
13                    1.866667          0 FM3
14                    1.200000          1 FM3
15                    1.466667          1 FM3
16                    2.000000          1 FM3
17                    1.200000          1 FM3
18                    0.800000          1 FM3
I'm still very new to R and thankful for any help to solve my problem!

