指定单个boxplot通道的ggplot2框图宽度?

时间:2018-08-20 17:25:06

标签: r ggplot2 boxplot

我有以下方框图,其中分组生成双泳道,与单个对照组进行比较。

require(reshape2)
require(ggplot2)
require(dplyr)
require(tidyr)

A1_0d_ret<-rnorm(1:100,20)
A2_4d_ret<-rnorm(1:100,18)
A3_14d_ret<-rnorm(1:100,30)
A4_4d_pan<-rnorm(1:100,7)
A5_14d_pan<-rnorm(1:100,40)

data<-data.frame(A1_0d_ret,
A2_4d_ret,
A3_14d_ret,
A4_4d_pan,
A5_14d_pan)

long.data<-melt(data)

long.data_<-separate(data = long.data, col = variable, into = c("group", "treatment", "species"), sep = "_", remove=FALSE)

ggplot(long.data_, aes(x=treatment, y=log(value), group=variable))+
geom_boxplot(aes(col=species), outlier.shape = NA, width=0.2 )+
scale_fill_manual(values=c("white", "black"))+
geom_point(shape=16,size=0.8, col= "grey", position=position_dodge(0.2))+
geom_vline(xintercept = 1.5, linetype="dotted")+
scale_x_discrete("NONO")+
scale_y_continuous("X (ng)")+
theme_classic()

This is the output: see control group on the lafthand side 拜托,我有以下天真问题:

如何使对照组(即第一条车道)的宽度与其他组的宽度相同?

编辑:我正在使用RStudio版本1.1.456 –©2009-2018 RStudio,Inc。

0 个答案:

没有答案