plotting beginner here...
I'm trying to get Matplotlib to add circles to a figure in a loop such that it runs 'N' times. N is given by user input and for my application likely won't exceed 10.
The radii and x-coordinates of the circles are generated in a previous function. I only want them to lie on a line, so there are no y-coords. In the end I'll end up with a horizontal row of circles of varying sizes.
I'd like a loop that adds each circle to a figure, some psuedo code of what I have in mind below:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
N = input('how many circles: ')
circle_list = []
circle = []
circle_size = [1,2,3]
circle_x = [1,2,3]
for i in range N:
circle_list[i] = [circle_size[i],circle_x[i]]
circle[i] = plt.Circle((circle_x[i],0), circle_size[i])
ax.add_artist(circle[i])
The second to last line is what's confusing me, I'm struggling to write a command that takes the circle size and coords, and adds plt objects 'N' times. I think I might need two loops to run through circle_list but I'm not sure.
I've explicitly written this script for 3 circles to test the coords and sizes are working ok, but now I'd like it in a loop.
Any help is appreciated!