# Create circles with matplotlib easily

I’ve made a simple way to make circles
I don’t know if anyone is interested but if anyone suggests an improvement I’ll gladly accept

``````import matplotlib.pyplot as py
x_list=[];x_list2=[]

y_list=[];y_list2=[]
for i in range(51):
print(i,(50**2-i**2)**0.5)
x_list.append(i);x_list2.append(-i)
y_list.append((50**2-i**2)**0.5);y_list2.append(0-(50**2-i**2)**0.5)
py.plot(x_list,y_list)
py.plot(x_list,y_list2)
py.plot(x_list2,y_list2)
py.plot(x_list2,y_list)
py.show()
``````

From this question I am not entirely sure what you are trying to do.

If you want to generate the (x,y) points on a circle, I would suggest using numpy so you can take advantage of broadcasting, something like:

``````import numpy as np
theta = np.linspace(0, 2-np.pi, 51)

r = 50
x = np.cos(theta) * r
y = np.sin(theta) * r
``````

If the goal is to place circles size in data coordinates on the Axes, looking at `Circle` (Circles, Wedges and Polygons — Matplotlib 3.5.3 documentation) is probably the best route to take (you just have to tell Matplotlib where to put the circle and how big it is and we take care of sampleing the path).

If the goal is to put circles where the size depends on a variable, thes `ax.scatter` (Scatter plot — Matplotlib 3.5.3 documentation) is probably the best option.

Thank you for the suggestions
But I’m trying to use less modules and write as much as I can by myself,but it’s very nice to hear opinions

I’m trying to use less modules and write as much as I can by myself

what do you mean by this/which part of the suggestion would you consider `too much modules`?

Not any specific part…I just prefer my codes /algorithms written by myself more than modules
It’s definitely good experimenting sometimes
Thank you