A chart that relates continuous variables to discrete variables revealed differences between groups. I need to highlight which categories are the same and different in a straightforward and simple way.
To do this, I need to label with the same letters the categories that are not different and with different letters those that were different.
plot_concentration <- ggplot(tabmean_con, aes(x = time, y = concentration, "color" = "2", "6")) +
geom_errorbar(
aes(ymin = concentration - se, ymax = concentration + se),
width = 0.1
) +
geom_point(
data = tabmean_con, aes(x = time, y = concentration),
col = "black", size = 3
) +
geom_text(aes(y = concentration + se, label = ""),
col = "black",
size = 4, vjust = -0.5, hjust = 0.4
) +
labs(
x = "hours",
y = "nectar concentration ( % brix)",
title = "Nectar concentration"
) +
theme_classic() +
scale_x_discrete(limits = positions) +
theme(
axis.title = element_text(size = 15),
legend.title = element_text(size = 14),
legend.position = c(0.3, 0.8)
) +
scale_y_continuous(limits = c(0, 30))
I tried this code above, where the data set is tabmean_con
, which is an object I created using the summarySE()
function from the Rmisc
package.
In the first layer after the color
argument, '2' and '6' are the y-axis categories that are the same and I would like to color them differently from the others. However I need to put letters on them to differentiate them. according to the result of Tukey's post hoc test, which indicates between which groups there are differences after an ANOVA