R 更改已整理绘图上的字体大小
我想在一个整理过的绘图上,使轴上的字体变大。我希望对比图上的轴和每个单独图上的轴都更大。有没有一种简单的方法可以做到这一点,而无需单独进入我整理过的每个绘图并更改字体大小——例如,我可以向plot_grid()函数添加任何内容来实现这一点?上下文代码包含在下面R 更改已整理绘图上的字体大小,r,ggplot2,plot,R,Ggplot2,Plot,我想在一个整理过的绘图上,使轴上的字体变大。我希望对比图上的轴和每个单独图上的轴都更大。有没有一种简单的方法可以做到这一点,而无需单独进入我整理过的每个绘图并更改字体大小——例如,我可以向plot_grid()函数添加任何内容来实现这一点?上下文代码包含在下面 # Make Figure 4. # Flanker. flanker.Training <- ggplot(data=correlations, aes(x=`Flanker.Con-Incon`, y=Training.ACC)
# Make Figure 4.
# Flanker.
flanker.Training <- ggplot(data=correlations, aes(x=`Flanker.Con-Incon`, y=Training.ACC)) +
geom_smooth(method = "lm", color="#CEB888") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Flanker") +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
labs(title="Training") +
theme(panel.grid.major.y = element_line(colour="grey"))
flanker.Training
flanker.Pretest <- ggplot(data=correlations, aes(x=`Flanker.Con-Incon`, y=`Pre-test.ACC`)) +
geom_smooth(method = "lm", color="#CEB888") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Flanker") +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
labs(title="Pre-test") +
theme(panel.grid.major.y = element_line(colour="grey"))
flanker.Pretest
flanker.Posttest <- ggplot(data=correlations, aes(x=`Flanker.Con-Incon`, y=`Post-test.ACC`)) +
geom_smooth(method = "lm", color="#CEB888") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Flanker") +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
labs(title="Post-test") +
theme(panel.grid.major.y = element_line(colour="grey"))
flanker.Posttest
flanker.PostPre <- ggplot(data=correlations, aes(x=`Flanker.Con-Incon`, y=`Post-Pre.ACC`)) +
geom_smooth(method = "lm", color="#CEB888") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Flanker") +
scale_y_continuous(name=expression(Delta~p(Correct))) +
theme(legend.position="none") +
labs(title="Learning") +
theme(panel.grid.major.y = element_line(colour="grey"))
flanker.PostPre
# Pitch.
pitch.Training <- ggplot(data=correlations, aes(x=Pitch.Dprime, y=Training.ACC)) +
geom_smooth(method = "lm", color="#004369") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Pitch perception (d')", limits=c(-0.6, 4.2)) +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
pitch.Training
pitch.Pretest <- ggplot(data=correlations, aes(x=Pitch.Dprime, y=`Pre-test.ACC`)) +
geom_smooth(method = "lm", color="#004369") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Pitch perception (d')", limits=c(-0.6, 4.2)) +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
pitch.Pretest
pitch.Posttest <- ggplot(data=correlations, aes(x=Pitch.Dprime, y=`Post-test.ACC`)) +
geom_smooth(method = "lm", color="#004369") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Pitch perception (d')", limits=c(-0.6, 4.2)) +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
pitch.Posttest
pitch.PostPre <- ggplot(data=correlations, aes(x=Pitch.Dprime, y=`Post-Pre.ACC`)) +
geom_smooth(method = "lm", color="#004369") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Pitch perception (d')", limits=c(-0.6, 4.2)) +
scale_y_continuous(name=expression(Delta~p(Correct))) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
pitch.PostPre
# Identification slope.
id.Training <- ggplot(data=correlations, aes(x=ID.Slope, y=Training.ACC)) +
geom_smooth(method = "lm", color="#BAA892") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Identification slope", limits=c(0, 0.3)) +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
id.Training
id.Pretest <- ggplot(data=correlations, aes(x=ID.Slope, y=`Pre-test.ACC`)) +
geom_smooth(method = "lm", color="#BAA892") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Identification slope", limits=c(0, 0.3)) +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
id.Pretest
id.Posttest <- ggplot(data=correlations, aes(x=ID.Slope, y=`Post-test.ACC`)) +
geom_smooth(method = "lm", color="#BAA892") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Identification slope", limits=c(0, 0.3)) +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
id.Posttest
id.PostPre <- ggplot(data=correlations, aes(x=ID.Slope, y=`Post-Pre.ACC`)) +
geom_smooth(method = "lm", color="#BAA892") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Identification slope", limits=c(0, 0.3)) +
scale_y_continuous(name=expression(Delta~p(Correct))) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
id.PostPre
# Within-category discrimination.
discrimination.Training <- ggplot(data=correlations, aes(x=Discrimination.Dprime, y=Training.ACC)) +
geom_smooth(method = "lm", color="#79AFBA") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Discrimination (d')", limits=c(-0.6, 4.2)) +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
discrimination.Training
discrimination.Pretest <- ggplot(data=correlations, aes(x=Discrimination.Dprime, y=`Pre-test.ACC`)) +
geom_smooth(method = "lm", color="#79AFBA") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Discrimination (d')", limits=c(-0.6, 4.2)) +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
discrimination.Pretest
discrimination.Posttest <- ggplot(data=correlations, aes(x=Discrimination.Dprime, y=`Post-test.ACC`)) +
geom_smooth(method = "lm", color="#79AFBA") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Discrimination (d')", limits=c(-0.6, 4.2)) +
scale_y_continuous(name="p(Correct)", limits=c(0.4, 1)) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
discrimination.Posttest
discrimination.PostPre <- ggplot(data=correlations, aes(x=Discrimination.Dprime, y=`Post-Pre.ACC`)) +
geom_smooth(method = "lm", color="#79AFBA") +
geom_point() +
theme_cowplot(font_size=16) +
scale_x_continuous(name="Discrimination (d')", limits=c(-0.6, 4.2)) +
scale_y_continuous(name=expression(Delta~p(Correct))) +
theme(legend.position="none") +
theme(panel.grid.major.y = element_line(colour="grey"))
discrimination.PostPre
# Collate to columns.
F4.C1 <- plot_grid(flanker.Training, pitch.Training, id.Training, discrimination.Training,
align="v", ncol=1,
rel_heights = c(0.28, 0.24, 0.24, 0.24))
F4.C1
F4.C2 <- plot_grid(flanker.Pretest, pitch.Pretest, id.Pretest, discrimination.Pretest,
align="v", ncol=1,
rel_heights = c(0.28, 0.24, 0.24, 0.24))
F4.C2
F4.C3 <- plot_grid(flanker.Posttest, pitch.Posttest, id.Posttest, discrimination.Posttest,
align="v", ncol=1,
rel_heights = c(0.28, 0.24, 0.24, 0.24))
F4.C3
F4.C4 <- plot_grid(flanker.PostPre, pitch.PostPre, id.PostPre, discrimination.PostPre,
align="v", ncol=1,
rel_heights = c(0.28, 0.24, 0.24, 0.24))
F4.C4
# Collate/print Figure 3.
Figure4 <- plot_grid(F4.C1, F4.C2, F4.C3, F4.C4,
align="h", nrow=1)
Figure4
pdf("Figure4.pdf", 16, 16, bg="transparent")
plot(Figure4)
dev.off()
#制作图4。
#侧翼。
如果你愿意切换到拼图软件包进行情节合成,你可以通过&主题(…)
操作轻松设置全局主题元素。下面是一个简化的例子
库(拼凑)
图书馆(GG2)
P