ggplot2 does not seem to have a built-in way to work with the add-in for text on scatterplots . However, I have a different situation where the labels are the ones on the discrete axis, and I wonder if anyone has a better solution than what I did.
Code example:
library(ggplot2)

So, we see that the labels of the x axis are located one above the other. Two spring solutions: 1) abbreviation for labels and 2) adding new lines to labels. In many cases (1), but in some cases this is not possible. So I wrote a function to add new lines ( \n ) for every nth character for lines, to avoid matching names:
library(ggplot2) #Inserts newlines into strings every N interval new_lines_adder = function(test.string, interval){ #length of str string.length = nchar(test.string) #split by N char intervals split.starts = seq(1,string.length,interval) split.ends = c(split.starts[-1]-1,nchar(test.string)) #split it test.string = substring(test.string, split.starts, split.ends) #put it back together with newlines test.string = paste0(test.string,collapse = "\n") return(test.string) } #a user-level wrapper that also works on character vectors, data.frames, matrices and factors add_newlines = function(x, interval) { if (class(x) == "data.frame" | class(x) == "matrix" | class(x) == "factor") { x = as.vector(x) } if (length(x) == 1) { return(new_lines_adder(x, interval)) } else { t = sapply(x, FUN = new_lines_adder, interval = interval) #apply splitter to each names(t) = NULL #remove names return(t) } } #plot again ggplot(test.data, aes_string(x = "text", y = "mean")) + geom_point(stat="identity") + geom_errorbar(aes(ymax = CI.upper, ymin = CI.lower), width = .1) + scale_x_discrete(labels = add_newlines(test.data$text, 20), name = "")
And the result: 
Then you can spend some time at intervals to avoid too much space between the marks.
If the number of labels changes, this solution is not so good, because the optimal interval size changes. In addition, since the regular font is not a monolayer, the label text also affects the width, and therefore you need to carefully monitor the choice of a good spacing (this can be avoided by using a monospatial font, but they are very wide). Finally, the new_lines_adder() function is stupid in that it will split the words into two in stupid ways that people would not. For example. in the above, he broke "breath" into "br \ nreath". One could rewrite it to avoid this problem.
You can also reduce the font size, but this is a compromise with readability and often reducing the font size is not required.
What is the best way to handle this type of shortcut add-ons?