how to plot ellipse given a general equation in R?

前端 未结 3 1681
南笙
南笙 2020-12-16 06:14

Ellipse general equation:

a * x ^ 2 + b * y ^ 2 + c * x * y + d * x + e * y + f = 0

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-16 06:54

    You can use my package PlaneGeometry (soon on CRAN, hopefully):

    library(PlaneGeometry)
    
    ell <- EllipseFromEquation(A = 4, B = 2, C = 3, D = -2, E = 7, F = 1)
    box <- ell$boundingbox()
    plot(NULL, asp = 1, xlim = box$x, ylim = box$y, xlab = NA, ylab = NA)
    draw(ell, col = "yellow", border = "blue", lwd = 2)
    

提交回复
热议问题