# Same output as with geom_point()
ggplot(mpg[1:20, ],
aes(cyl, hwy)) +
geom_point_s(colour = "blue")
# with segment drawn after nudging
ggplot(mpg[1:20, ],
aes(cyl, hwy, label = drv)) +
geom_point_s(position = position_nudge_keep(x = 0.2),
colour = "red") +
geom_point_s(colour = "blue") +
expand_limits(x = c(3.5, 8.5))
ggplot(mpg[1:20, ],
aes(cyl, hwy, label = drv)) +
geom_point_s(position = position_nudge_keep(x = 0.2),
colour = "blue",
move.point = FALSE) +
expand_limits(x = c(3.5, 8.5))
# with segment drawn after nudging
ggplot(mpg[1:20, ],
aes(cyl, hwy, label = drv)) +
geom_point_s(position = position_nudge_keep(x = 0.2),
colour = "red",
colour.target = "all") +
geom_point_s(colour = "blue")
ggplot(mpg[1:20, ],
aes(cyl, hwy, label = drv)) +
geom_point_s(position = position_nudge_keep(x = 0.2),
colour = "red",
colour.target = "segment") +
geom_point_s(colour = "blue")
ggplot(mpg[1:20, ],
aes(cyl, hwy, label = drv)) +
geom_point_s(position = position_nudge_keep(x = 0.2),
colour = "red",
colour.target = "point") +
geom_point_s(colour = "blue")
ggplot(mpg[1:50, ],
aes(cyl, hwy, label = drv)) +
geom_point_s(position = position_jitternudge(width = 0.66, height = 2,
seed = 456,
nudge.from = "jittered",
kept.origin = "original"),
colour = "red",
alpha = 0.3, alpha.target = "segment",
arrow = grid::arrow(length = grid::unit(0.4, "lines"),
ends = "first")) +
geom_point_s(colour = "blue")
Run the code above in your browser using DataLab