Skip to content

Instantly share code, notes, and snippets.

@adisarid
Created August 16, 2020 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adisarid/19127c3780a01a419844e6d248120e39 to your computer and use it in GitHub Desktop.
Save adisarid/19127c3780a01a419844e6d248120e39 to your computer and use it in GitHub Desktop.
example1 <- tribble(~x, ~y, ~x_end, ~y_end,
0, 0, 1, 1,
1.5, 1, 2, 2,
3, 5, 4, 2)
example_pointed <- example1 %>% select(x,y) %>%
bind_rows(example1 %>% select(x_end, y_end) %>% set_names(c("x", "y")))
ggplot(example1, aes(x = x, y = y)) +
geom_segment(aes(x = x, y = y, xend = x_end, yend = y_end), lineend = "round") +
geom_point(data = example_pointed, inherit.aes = FALSE, aes(x = x, y = y), color = "red")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment