我将动物实验的数据分为三类。首先是1)KO和WT,2)时间点和3)同侧或对侧。我需要在一个图表中表示这三个变量。我使用以下ggplot命令:
Line_Iba1_Area <- ggplot(M_Iba1_Area, aes(x = Group, y = value, colour = variable, shape = Stamm, group=interaction(variable, Stamm))) +
theme_classic () +
theme(plot.title = element_text(family = "Times", color="black", face="bold", size=16, hjust=0.5, margin = margin(t = 0, r = 0, b = 20, l = 0)))+
theme(axis.title.x = element_text(family = "Times", color="black", face="bold", size=16, margin = margin(t = 20, r = 0, b =0, l = 0))) +
theme(axis.title.y = element_text(family = "Times", color="black", face="bold", size=16, angle=90)) +
theme(legend.title=element_text(face="bold", family="Times", colour="black", size=12)) +
theme(axis.text.x=element_text(family = "Times", color = "black", size=12)) +
theme(axis.text.y=element_text(family = "Times", color = "black", size=12)) +
labs(title = "Iba1 Area", x = "Time Point", y = "Labeled Area (pixels)", colour = "Hemisphere") +
scale_x_discrete(breaks=c("1. Control", "2. 1Day", "3. 3Days", "4. 7Days", "5. 14Days"),
labels=c("Naive","1 Day", "3 Days", "7 Days", "14 Days")) +
stat_summary(fun.y = mean, geom = "point", size=2, aes(group = variable)) +
stat_summary(fun.y = mean, geom = "line", size=0.7, aes(group = variable)) +
stat_summary(fun.data = mean_cl_boot, geom = "errorbar", width = 0.5) +
geom_point(position = position_jitterdodge()) +
facet_grid(Stamm ~ .)
然后我得到
然而,他们只是为了线。我需要1)ipsilateral-KO,contraletral-KO,ipsilateral-WT,contraletral-WT
如果我在结尾添加facet_grid(Stamm~。),我获得了我需要的所有变量但是分为两个轴(两个图形)。
我需要的是两者的组合(使用四条指定的行)。如果您能为我提供有用的示例,我将不胜感激。