xy <- matrix(round(rnorm(20, 100, 15), 2), ncol=2)
mc <- getMinCircle(xy)
# determine axis limits so that circle will be visible
xLims <- mc$ctr[1] + c(-mc$rad, mc$rad)
yLims <- mc$ctr[2] + c(-mc$rad, mc$rad)
plot(xy, pch=16, asp=1, xlim=xLims, ylim=yLims)
drawCircle(mc$ctr[1], mc$ctr[2], mc$rad, fg='blue')
Run the code above in your browser using DataLab