rnorouzian
rnorouzian

Reputation: 7517

How to create concentric ellipses in R plot

I was wondering how I can draw parallel concentric ellipses (oval shape lines) just like the grey, oval dashed lines in the picture below in my R plot?

Here is my small R code:

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

enter image description here

Upvotes: 0

Views: 410

Answers (1)

KoenV
KoenV

Reputation: 4283

You could use the draw.ellipse() from the plotrix package like this (you will need to adjust some values to get exactly what you want):

# 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 and y are the coordinates of the center.
  • a and b give the radii of the ovals
  • lty defines the line type

Upvotes: 1

Related Questions