我已经根据性别对ggplot进行了着色,但我想显示所有数据点的均值和标准误,而不是分别针对男性和女性。
我尝试在较低的代码行中应用填充颜色,但这似乎不起作用。
`Plot <- ggplot(Averaged.output.spreadsheet,
aes(x=Averaged.output.spreadsheet$Group,
y=Averaged.output.spreadsheet$Pos.per.mm.media,
fill=Averaged.output.spreadsheet$Sex)) +
geom_boxplot() +
geom_dotplot(binaxis='y', stackdir='center', binwidth = 1, stackratio = 1, method = "histodot" ) +
scale_x_discrete(limits=c("UT", "ABT until 3wo")) +
theme_classic() +
theme(axis.text.x = element_text(family="Arial", face="bold", size=16),
axis.text.y = element_text(family="Arial", face="bold", size=12),
axis.title.y.left = element_text(family="Arial", face="bold", size=16),
legend.title = element_text(family="Arial", face="bold", size=14),
legend.text = element_text(family="Arial", face="bold", size=12)) +
labs(x = NULL, y = "Neutrophils / mm^2 Media", fill = "Sex")`
此代码在一列中显示点,但在x轴上为每个类别并排显示两个方框。