I am facing a smal issue concerning positioning labels on an R graph. I made an example with the data available in ggplot2
package to make it executable.
library(ggrepel)
library(ggplot2)
library(tidyverse)
pos <- position_jitter(seed = 1, height = 0.25)
ggplot(mtcars, aes(vs, wt, group = am, label = wt)) +
geom_jitter(position = pos) +
geom_text_repel(aes(label = ifelse(wt > 3, wt, "")), position = pos)
I used the command position_jitter
to define jitter and geom_text_repel
to set data labels. Using position_jitter
I cannot define a position nudge_y
of data labels but I woukld like to add to the defined position (position_jitter(seed = 1, height = 0.25)
) a fixed value, let's say +0.5, so as to shift up systematically every label of a defined value.
Is it possible to make in R something like this?
Thank you in advance for every your reply!