Text size in geom_text

Here is an example I adapted from combining your code with the FeatureScatter documentation:


library(Seurat)
library(ggplot2)
data("pbmc_small")
text.size <- 1
FeatureScatter(object = pbmc_small, feature1 = 'CD9', feature2 = 'CD3E',
               cols = c("#cccccc", "#de2d26","#000000")) +
  geom_hline(yintercept = 50, col= "black", linetype= "dashed")+
  geom_vline(xintercept = 800, col= "black", linetype = "dashed")+
  labs(x= "A", y="B")+
  geom_text(aes(Inf, 50, label= "50", hjust =1, vjust= -1, family = "sans"), size= text.size)+
  geom_text(aes(800, Inf, label="800", hjust=-0.5, vjust = 1, family= "sans"), size=text.size)+ 
  scale_x_log10()

so if you try size 1 vs 4, you will see the labels at the extreme top right of chart be different sizes.
My main change here was in moving out , size= text.size from being an aesthetic mapping in geom_text, and rather a fixed param of the geom_text.