如何在R plot

时间:2017-03-26 03:32:31

标签: r plot

我想知道如何绘制平行 同心椭圆(椭圆形线条)只是就像我R中下面图片中的灰色椭圆虚线一样情节吗

这是我的小R代码:

plot(1, ty='n', ann = F, bty = "l", tcl = F )
text(1, 1, "?", cex = 5)

enter image description here

1 个答案:

答案 0 :(得分:1)

你可以像这样使用plotrix包中的draw.ellipse()(你需要调整一些值来得到你想要的):

# your code
plot(1, ty='n', ann = F, bty = "l", tcl = F )
text(1, 1, "?", cex = 5)

# code to create concentric ovals
library(plotrix)
draw.ellipse(x= rep(1,9), y= rep(1,9), a= seq(.1, .9, by = .1), b= seq(.05, .45, by = .05), lty = 2)
  • x和y是中心的坐标。
  • a和b给出椭圆的半径
  • lty定义线型