I need to draw a line around all of my data points that plot within x-y space. I do not need 2d density distribution. See the picture attached (the field was just drawn manually). Thank you. scatter plot with line around data points
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
This is the perfect use case for ggalt
's geom_encircle
:
#install.packages('ggalt')
library(ggalt)
#> Loading required package: ggplot2
ggplot(iris, aes(Sepal.Length, Sepal.Width)) +
geom_point() +
geom_encircle()
You can also encircle by group:
ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point() +
geom_encircle()