below a reproducible example of my grouped bar plot. I am struggling with the space / padding between the groups. I already found some question on stackoverflow like this and here.
I also played around with the geom_bar(position= ..
argument to be either "dodge"
or dodge_position(0.5)
and also with the width of my bars. However I dont want to increase the width of my bars anyfurther. Is there any solution like changing the size of the discrete x axis to reduce the labeled spaces in figure 1? Update: Reduced the code to make it more minimal for the minimal reproducible example. The Problem remains the same
library(ggplot2)
library(ggthemes)
library(dplyr)
algorithm <- c(rep("0_DT",2),rep("1_RF",2),rep("2_MLP",2))
target <- rep(c("Some Data","Some Other Data"),3)
value <- runif(6,85,95) # Simulated Accuracies
CI_lower <- value - 5
CI_upper <- value + 5
data <- data.frame(target,algorithm,value,CI_lower,CI_upper)
ggplot(data, aes(fill=algorithm, y=value, x=target)) +
geom_bar(position=position_dodge(0.75), stat="identity", width = 0.65)+ theme_classic()+
scale_fill_manual("Algorithm",
values = alpha(c("0_DT" = "#20639B", "1_RF" = "#3CAEA3", "2_MLP" = "#F6D55C"),0.8),
labels=c("DT","RF","MLP"))+
scale_y_continuous("Accuracy in %",limits = c(0,100),oob = rescale_none,
# breaks= sort(c(seq(0,90,10),h)),
breaks= seq(0,100,10),
expand = c(0,0))
And here is my Barchart Figure 1