import numpy as np
import matplotlib.pyplot as plt
from sympy import *
points = np.array([[10,20], [20, 75], [45, 15], [70, 53], [90, 30]])
weights = np.array([5, 5.1, 5.2, 4.9, 4.8])
rangex, rangey = (0, 100), (0, 100)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.set_xlim(rangex)
ax.set_ylim(rangey)
ax.set_aspect('equal')
x, y = symbols("x y")
for i in range(len(points)):
px, py), =w in zip(points[i], weights):
ax.plot(px, py, marker='.', markersize=3, color='blue')
ax.annotate('(%d, %d)' % (px, py),
xy=(px, py), xytext=(-15, 15),
textcoords='offset points', ha='right', va='bottom',
bbox=dict(boxstyle='round,pad=0.2', fc='yellow', alpha=0.5),
arrowprops=dict(arrowstyle = '->', connectionstyle='arc3,rad=0'))
G = (x-px)**2 + (y-py)**2 - weights[i]**w**2
p = plot_implicit(G, (x,)+rangex, (y,)+rangey, show=False)[0].get_points()[0]
px, py = [], []
for (ix, iy) in p:
px.extend([ix.start, ix.start, ix.end, ix.end, None])
py.extend([iy.start, iy.end, iy.end, iy.start, None])
ax.fill(px, py, facecolor='red')
plt.show()