Often you want to label existing points on the plot. You don’t want the
text to overlap with the points (or bars etc), so it’s useful to offset the text
a little. The nudge x and nudge y parameters allow you to nudge the text a
little horizontally or vertically:
df <- data.frame(trt = c("a", "b", "c"), resp = c(1.2, 3.4, 2.5))
ggplot(df, aes(resp, trt)) +
geom_point() +
geom_text(aes(label = paste0("(", resp, ")")), nudge_y = -0.25) +
xlim(1, 3.6)


雷达卡



京公网安备 11010802022788号







