View source: R/position-nudge.R
position_nudge | R Documentation |
This is useful if you want to nudge labels a little ways from their points.
position_nudge(x = 0, y = 0)
x, y |
Amount of vertical and horizontal distance to move. |
Other position adjustments:
position_dodge()
,
position_fill()
,
position_identity()
,
position_jitterdodge()
,
position_jitter()
df <- data.frame(
x = c(1,3,2,5),
y = c("a","c","d","c")
)
ggplot(df, aes(x, y)) +
geom_point() +
geom_text(aes(label = y))
ggplot(df, aes(x, y)) +
geom_point() +
geom_text(aes(label = y), position = position_nudge(y = -0.1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.