I am having trouble showing the points of interest on my ggplot. When I select for my genes in geom_label_repel() i only get 3 that appear when i know that there are 57 that show up in the list.
fig1. Here is what I am getting when running geom_label_repel
Ive tried changing geom_label_repel to geom_text but the box shown in geom_label_repel makes the text easier to read. I have also isolated just the points of interest and graph that and it resulted in all my points being shown so i know the issue is somewhere in the label_repel line.
results_df$Gene <- rownames(resultsLFC_df)
#create named character vector for color palette
palette <- c("Upregulated" = "red",
"Downregulated" = "blue",
"Not_significant" = "gray")
# show volcano plot
results_df %>%
mutate(Expression = if_else(padj < custom_alpha & log2FoldChange > 0, "Upregulated",
if_else(padj < custom_alpha & log2FoldChange < 0, "Downregulated", "Not_significant"))) %>%
ggplot(aes(x = log2FoldChange, y = -log10(padj), color = Expression)) +
geom_point(alpha = 0.8, size = 0.5) +
geom_vline(xintercept = 0, linetype = "dashed") +
geom_hline(yintercept = -log10(custom_alpha), linetype = "dashed") +
geom_text(
aes(label = ifelse(Gene %in% genes_to_label, as.character(Gene), "")), color = "black",
arrow = arrow(length = unit(0.02, "npc")),
box.padding=.5, point.padding=0.5, segment.color="black", show.legend=FALSE, max.overlaps = 10,
hjust=0,vjust=0) +
# geom_label_repel(
# aes(label = if_else(Gene %in% genes_to_label, Gene, "")),
# arrow = arrow(length = unit(0.02, "npc")),
# box.padding=.1, point.padding=0.5, segment.color="gray70", show.legend=FALSE, max.overlaps = 20
# ) +
labs(title = condition_contrast, x = "log2(Fold Change)", y = "-log10(padj)") +
scale_color_manual(values = palette, limits = names(palette))+
theme_classic()
I have shown both of my geom_text and geom_label_repel as ive been trying to work through them.


geom_text_repelwork better for you if you adjust parameters likemax.overlaps = getOption("ggrepel.max.overlaps", default = 10)or if you reduce the font size or label padding? I presume the data has too many overlaps to show more observations.