Hi yall,
I have a real quick question about my boxplot. I wanted to know if there was any code that I could use in ggplots/tidyverse to make sure that my X-axis values were aligned properly with there respective ticks. I have attached a figure of my boxplot so I could show how they are not aligned. Also, does anyone know how I can fill in the boxes with their respective colors? I will also post my code down below just in case. Also, my Asterisk are not aligned properly.
Code -
df <- Normalized_Ranged_Data_of_TF_for_summer_project
new_df <- df %>%
gather(key = "mutant", value = "amount") %>% filter(complete.cases(.))
new_df$mutant <- as.character(new_df$mutant)
new_df$mutant <- factor(new_df$mutant, levels=unique(new_df$mutant))
p <- new_df %>%
ggplot(aes(x=mutant, y=amount)) + geom_boxplot(col=ifelse(colnames(NF)=='TF33'|colnames(NF)=='TF59'|colnames(NF)=='TF117'|colnames(NF)=='TF122'|colnames(NF)=='TF133'|colnames(NF)=='TF137'|colnames(NF)=='TF156'|colnames(NF)=='TF164'|colnames(NF)=='TF169'|colnames(NF)=='TF172'|colnames(NF)=='TF175',"blue","Orange"))
p <- p + theme(axis.text.x = element_text(angle = 90, hjust = 1), text=element_text(size=8,family="Serif")) +
ggtitle("Flocculation Level of Mutants ") +
xlab("Mutant Transcription Factors") + ylab("Degree of Flocculation")
f <- p + geom_text(aes(x = "SN250", y = 1.5, label = "")) + geom_text(aes(x = "TF33", y = 2, label = "")) + geom_text(aes(x = "TF59", y = 2, label = "")) + geom_text(aes(x = "TF117", y = 2, label = "")) + geom_text(aes(x = "TF122", y = 2, label = "")) + geom_text(aes(x = "TF132", y = 2, label = "")) + geom_text(aes(x = "TF137", y = 2, label = "")) + geom_text(aes(x = "TF156", y = 2, label = "")) + geom_text(aes(x = "TF164", y = 2, label = "")) + geom_text(aes(x = "TF169", y = 2, label = "")) + geom_text(aes(x = "TF172", y = 2, label = "")) + geom_text(aes(x = "TF175", y = 2, label = ""))
f <- f + geom_hline(yintercept=1, linetype="dashed", color = "red")
Thank you all for your help on my previous questions,
Gabriel Viramontes