ant*_*sor 3 r ellipse scatter-plot ggplot2
左边两列代表地理结构的坐标XY,左边两列代表“每个”地理单元的大小(南北直径和东西直径)
我想以图形方式表示一个散点图,在其中绘制所有坐标并在每个点上绘制一个椭圆,包括每个地理单位的直径。
我该如何使用 ggplot2 来做到这一点?
您可以在这里下载数据
使用geom_ellipse()ggforce:
library(ggplot2)
library(ggforce)
d <- data.frame(
x = c(10, 20),
y = c(10, 20),
ns = c(5, 8),
ew = c(4, 4)
)
ggplot(d, aes(x0 = x, y0 = y, a = ew/2, b = ns/2, angle = 0)) +
geom_ellipse() +
coord_fixed()
Run Code Online (Sandbox Code Playgroud)

由reprex 包(v0.2.1)于 2019-06-01 创建