Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def generateImagesOfVariousSizes(numberOfPoints):
directory = 'data/countingVariousSizes/' + str(numberOfPoints) + '/'
os.makedirs(directory, exist_ok=True)
#Create 5,000 images of this class
for j in tnrange(5000):
path = directory + str(j) + '.png'
#Get points
x, y = createNonOverlappingPoints(numberOfPoints)
#Create plot
axes = plt.gca()
axes.set_ylim([-2, 2])
#This time we'll generate a random size for each marker
sizes = [random.uniform(25, 250) for _ in range(len(x))]
plt.scatter(x,y, s=sizes)
plt.axes().set_aspect('equal', 'datalim')
#Save to disk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment