# Create the bar graph with trial means as points
tenminplot <- ggplot(tenmin, aes(x = genotype, y = moving, fill = genotype)) +
stat_summary(fun = "mean", geom = "bar") +
stat_summary(fun.data = "mean_se", geom = "errorbar", width = 0.2) +
geom_point(data = trial_means, # Use the trial_means data
aes(x = genotype, y = mean_moving, group = trial), # Map trial means
position = position_dodge(width = 0.5),
geom_signif(comparisons = list(c("egl-9", "hif-1")), # Adds significance levels
annotations = c("**"), # Manually set significance level
y_position = c(0.95), # Adjust vertical position of the significance stars and bar
textsize = 8, # Customize text size
tip_length = 0.05, # Customize the length of the significance lines
vjust = 0.5) + # Adjust vertical position of stars in relation to bar
geom_signif(comparisons = list(c("egl-9", "N2")), # Adds significance levels
annotations = c("**"), # Manually set significance level
y_position = c(1.1), # Adjust vertical position of the significance stars and bar
textsize = 8, # Customize text size
tip_length = 0.05, # Customize the length of the significance lines
vjust = 0.5) + # Adjust vertical position of stars in relation to bar
labs(title = "Movement at 10 Minutes",
scale_y_continuous(expand = expansion(mult = c(0.00, 0.1)))+ #moves 0 at y-axis to intersect the x-axis
axis.text.x = element_text(size = 14, angle = 45, vjust = 1, hjust = 1, face = "bold.italic"),
axis.text.y = element_text(size = 14, face = "bold"),
axis.title.x = element_text(size = 16, face = "bold", vjust = -3),
axis.title.y = element_text(size = 16, face = "bold"),
plot.title = element_text(size = 20, face = "bold"),
legend.position = "none") # Removes the legend