Putting a border around a series of dots in ggplot2

I have a number of points that I want to place around the border. How can i do this?

Here are my motives: enter image description here

I tried geom_line, but that was clearly wrong since it produced this!

enter image description here

thanks

+4
source share
1 answer

Use geom_path instead of geom_line . Here is an example:

 i <- seq(0, 2*pi, length.out=50) dat <- data.frame(x=cos(i), y=sin(i)) library(ggplot2) ggplot(dat, aes(x, y)) + geom_line() 

enter image description here

 ggplot(dat, aes(x, y)) + geom_path() 

enter image description here

+4
source

Source: https://habr.com/ru/post/1436376/


All Articles