I’ll give you a ggplot2
answer. For this, you need to reshape your data, so there are separate x and y variables. Right now, your y values are split between two columns.
Then we highlight the specific genes by only plotting points for a subset.
library(ggplot2)
library(dplyr)
library(tidyr)
gene_list <- c('C', 'F', 'G', 'I')
df_long <- gather(df, treatment, expression, -Gene)
ggplot(df_long, aes(treatment, expression)) +
geom_boxplot() +
geom_point(aes(color = Gene), filter(df_long, Gene %in% gene_list), size = 3) +
theme_minimal() +
labs(caption = 'p < 0.001')
For specific adjustments, please have a look at the many ggplot2
questions here on SO.
1
solved Highlight specific genes in boxplot