import numpy as np import matplotlib.pyplot as plt n = 1500 x = 1-2*np.random.random(int(n)) y = 1-2*np.random.random(int(n)) insideX, insideY = x[(x*x + y*y) <= 1], y[(x*x + y*y) <= 1] outsideX, outsideY = x[(x*x + y*y) > 1], y[(x*x + y*y) > 1] circle = plt.Circle((0, 0), 1, color='orange', fill=False) fig, ax = plt.subplots(1) ax.set_xlim(-1.1, 1.1) ax.set_ylim(-1.1, 1.1) ax.set_aspect('equal', 'box') ax.add_patch(circle) plt.savefig('circle-raw.png', bbox_inches='tight') ax.scatter(insideX, insideY, color= 'black') ax.scatter(outsideX, outsideY, color= 'black') plt.savefig('circle-black.png', bbox_inches='tight') ax.scatter(insideX, insideY, color= 'red') ax.scatter(outsideX, outsideY, color= 'blue') plt.savefig('circle-classified.png', bbox_inches='tight')