简体   繁体   中英

Removing some point from geom_point ggplot2

Say I have some tibble with coordinates called 'coordinates'. I plot these coordinates and I want to have it in points, so for that I use geom_points:

coordinates <- tibble(x = x_coords, y = y_coords)
ggplot(coordinates, aes(x = x, y = y)) + geom_point()

How would I change the geom_point() so that it for example always removes the point from the first coordinate in the plot when for example putting geom_point() + geom_line()

filter those points from your dataset:

coordinates <- tibble(x = x_coords, y = y_coords)

ggplot(coordinates, aes(x = x, y = y)) +
  geom_point(data = coordinates %>% filter(row_number() > 1)) +
  geom_line()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM