Q:

Plot circle that contains 80% (x, y) points

I have a 2d-array (x, y) of points and I would like to plot a circle that contains the 80% of this points and also I would like to know the radius of the resulting circle. Is there any way to do this with python? 
I've been looking for a way to do it but with no success. I apology for not presenting a try, but I'm totally lost with the condition of taking the 80% without giving a radius to the circle. 
Update:
I've tried the following:
import matplotlib.pyplot as plt

x=[1, 1.15, 1.23, 0.92, 1.31, 1.18, 1.27, 1.07, 3, 3.2]

y=[1.17, 0.95, 1.04, 1.32, 1, 1.22, 1.28, 0.99, 1, 1.2]

plt.plot(x, y, 'bo')
circle=plt.Circle((1.1, 1.12), 0.2, color='g', fill=False)
fig = plt.gcf()
fig.gca().add_artist(circle)
plt.axis([0, 3.5, 0, 3.5])
plt.show()

And this is the plot I want to obtain:

In this example I have 10 points and the circle is the minimum circle where 8 points are inside. I have done this example by eye, but what I want is: given x and y, get the parameters of the circle (the center position and the radius) that match the condition that at least 80% of points are inside it, i.e., how has to be the minimum circle that contains at least 80% of points. Is this possible? 

A:

As said by others, you could draw many different circles to obtain the requested result. But one quick and dirty way to do this might be:
import numpy as np
import matplotlib.pyplot as plt

# generate some random points
n = 1000
x = 4 * np.random.randn(n) + 15
y = 2 * np.random.randn(n) + 10

# somehow compute center of cloud, use e.g. medium or mean
x0 = np.median(x)
y0 = np.median(y)

# compute radius
r = np.sqrt((x - x0)**2 + (y - y0)**2)
t = 80 # percent
r0 = np.percentile(r, t)
n_within = (r < r0).sum()

# make plot    
plt.plot(x, y, '.')
circle = plt.Circle((x0, y0), r0, color='r', fill=False)
plt.gca().add_artist(circle)
plt.title('Found center at ({:.2f}, {:.2f})\n'
          '{}% radius is {:.2f}\n'
          '{} / {} points within circle'.format(
          x0, y0, t, r0, n_within, n))
plt.axis([0, 30, 0, 20])
plt.show()

Result:

