1

I want to make ellipse in R. The code is given below:

library(car)
A      <- matrix(c(2.2, 0.4, 0.4, 2.8), nrow=2)
ellipse(c(0, 0), shape=A, radius=0.98, col="red", lty=2)

But this code produces the following error:

Error in plot.xy(xy.coords(x, y), type = type, ...) : 
  plot.new has not been called yet

How can I resolve this?

halfer
  • 19,824
  • 17
  • 99
  • 186
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
  • 1
    supply the argument `add=FALSE` and it will create a new plot instead of trying to add to an existing one. There is also an `ellipse` package that I've used if you want another option. – Justin Mar 04 '13 at 17:14
  • Thanks @Justin for your help. Would you mind to change your comment into answer!!! So that I can accept your answer for future users. Thanks – MYaseen208 Mar 04 '13 at 17:16

1 Answers1

2

supply the argument add=FALSE and it will create a new plot instead of trying to add to an existing one. There is also an ellipse package that I've used if you want another option.

Justin
  • 42,475
  • 9
  • 93
  • 111