Placing a boundary around a series of points in ggplot2

烈酒焚心 提交于 2019-12-06 05:23:41

问题


I have a series of points that I want to place a boundary around. How can I go about this?

These are my points:

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

Thanks


回答1:


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()

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



来源:https://stackoverflow.com/questions/12603006/placing-a-boundary-around-a-series-of-points-in-ggplot2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!