The code snippet below creates bivariate normal data, plots it and then plots an ellipse along with the line y=x
require(ellipse); require(MASS)
mu <- c(30,30)
Sigma <- matrix(c(900,630,630,900),2,2,byrow=TRUE)
dt <- data.frame(mvrnorm(n=1000,mu,Sigma))
names(dt) <- c("x","y")
plot(dt$x,dt$y)
df_ell <- data.frame(ellipse(cor(dt$x, dt$y), scale=c(sd(dt$x),sd(dt$y)), centre=c(mean(dt$x),mean(dt$y))))
lines(df_ell)
abline(a=0,b=1)
The line y=x should pass through the major axis of the ellipse due the covariance structure and the equal means.
In a square graphic window, everything seems fine:
However, if the window is resized to make it no longer square, the ellipse seems to orient itself away from the line:
What is causing this to happen and is it expected behaviour ?