# Determine furthest points on an ellipsoid for charting purposes

#### leejayd

##### New Member
Hi,

I'm trying to plot an ellipsoid chart with the code below :

Code:
library(cluster)
x <- rnorm(150)
y <- rnorm(150) + 2*x + 10)
xy <- unname(cbind(x, y)
exy <- ellipsoidhull(xy)

maxx <- max(xy[,1])*3
maxy <- max(xy[,2])*3
minx <- min(xy[,1])/3
miny <- min(xy[,2])/3

plot(xy,  col="blue", xlab="Page Views", ylab="Conversions", main = "Performance Report", type='n', xlim=c(minx,maxx),ylim=c(miny,maxy))
# type = 'n' for no plots
# type = 'p' for points

lines(predict(exy), col="blue")
points(rbind(exy\$loc), col = "blue", cex = 2, pch = 13)
I need to zoom out to ensure the whole ellipsoid is shown. I'm doing this crudely at the minute with :

Code:
maxx <- max(xy[,1])*3
maxy <- max(xy[,2])*3
minx <- min(xy[,1])/3
miny <- min(xy[,2])/3
And then using these values to set the scale.

It would be better if I could determine the scale based on the outside edges of the ellipsoid along the X & Y axis.

I can get the shape matrix from the ellipsoidhull but not sure how to translate this to scale for the chart. Any ideas?

#### leejayd

##### New Member
I figured this out myself.

Using :
Code:
temp = predict(exy)

maxx <- max(temp[,1])
maxy <- max(temp[,2])
minx <- min(temp[,1])
miny <- min(temp[,2])