我有一些数据,我使用plot(x,y,..)函数绘制。现在我想在这个图上叠加三个椭圆。我知道每个轴的半径,我知道每个椭圆的中心。我怎么能在R中创建这样的椭圆。在互联网上没有太多的帮助。
答案 0 :(得分:3)
我不知道你的数据集是什么......所以我创建了随机的...我使用了plotrix
包...
library(plotrix)
df = data.frame(x=sample(1:25),y=sample(1:25,replace=T,25))
plot(df,col='blue')
draw.ellipse(x= c(15), y= c(15), c(4), c(3), border = 'black', lwd = 2)
draw.ellipse(x= c(15), y= c(15), c(5), c(4), border = 'green', lwd = 2)
draw.ellipse(x= c(15), y= c(15), c(6), c(5), border = 'red', lwd = 2)
我希望这会对你有帮助......