I'm trying to align the letters of my statistical analysis in the plot.
Here is my code:
pd = position_dodge(0.4)
ggplot(cld_trtdosepop,
aes(x = pop,
y = response*100,
#color = pop,
label = .group)) +
geom_point(shape = 15,
size = 5,
position = pd) + facet_grid(dose ~ trt) +
geom_hline(yintercept=50, size = 2, linetype="dashed", color = "red") +
geom_errorbar(aes(ymin = asymp.LCL100,
ymax = asymp.UCL100),
width = 0.2,
size = 0.5,
position = pd) + ylim(0, 105) +
theme_bw() +
theme(plot.title = element_text(face = "bold", hjust = 0.5, size = 38, colour = "black"),
axis.title = element_text(face = "bold", size = 35, colour = "black"),
axis.text.x = element_text(size = 22, colour = "black", face = "bold"),
axis.text.y = element_text(size = 22, colour = "black", face = "bold",
margin = margin(t = 2, b = 2, unit = "cm")),
legend.title = element_text(size = 35, face = "bold"),
legend.text = element_text(face = "bold", size = 35),
strip.text = element_text(face = "bold", size = 35, colour = "black"),
panel.spacing = unit(1.0, "lines")) +
ylab("Biomass reduction (%)") + xlab("Population") + coord_flip() +
ggtitle ("",
subtitle = "") +
geom_text(aes(label = .group, hjust = 0, y=92), # put letters at 92% on the Y-axis (right edge after flip)
size = 7,
fontface = "bold",
color = "black") +
ggsave("Biomass reduction square dot_tukey.jpeg", width = 16, height = 12, units = "in", dpi = 500)
Here is the outcome:
Any idea on how to fix it?