Relative Content

Tag Archive for rggplot2quarto

How to force data labels to not overlap in ggplot in R Quarto?

I am working with ggplot in R Quarto. I am trying to create a line graph with 3 longitudinal variables (so x = Year, Y = Var1, Var2, Var3). I want to show data labels for all three variables for each year. However, the problem is – data labels overlap, so one can’t see all labels. So far, I tried geom_label_repel, but while it tries to separate labels, they still overlap. (As a side note, for some reason, geom_label_repel also puts labels in different positions on a new render). I was wondering if anyone knows a way to automatically make data labels to be separate? (I have many plots like this, so looking for a universal solution rather than for a manual manipulation of this specific plot).