小编nOO*_*OOb的帖子

删除条形ggplot2之间的空格

这是我的代码

    ggplot(df, aes(x=timepoint, y=mean, fill=group)) +
            geom_bar(position=position_dodge(.3), colour="black", stat="identity", width=0.3, , binwidth=0) +
            geom_errorbar(position=position_dodge(.3), width=.25, aes(ymin=mean, ymax=mean+sem)) +
            scale_fill_manual(values=c("#FFFFFF", "#000000"), guide=FALSE) +
            theme_bw() +
            ylab(ylab) +
            xlab("") +
            # xlim("Baseline", "12w") +
            scale_x_discrete(expand = c(0,0), limits=c("Baseline","12w")) + 
            scale_y_continuous(expand = c(0,0) ) + 
            theme(panel.border = element_blank(), panel.grid.major = element_blank(), 
                  panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))
Run Code Online (Sandbox Code Playgroud)

这是我的输出,我不想要,它在"基线"和"12w"之间的空间太大:

在此输入图像描述

如何去除栏之间的空间?

谢谢

df是这样的:

df <- structure(list(group = c("a1.d.ffa.mean Dysglyc", "a1.c.ffa.mean Control", 
"b1.d.ffa.mean Dysglyc", "b1.c.ffa.mean Control"), timepoint = c("Baseline", 
"Baseline", "12w", "12w"), mean = …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

ggplot2 ×1

r ×1