# Plotting a circle in python with angles.

I have got some hard time dealing with angles in space, and because i skipped all of my geometry class i had no idea how to imagine angles in a circle so i decided to find a way to plot them using python

## First lets Import Modules

``````import matplotlib.pyplot as pl
from numpy import sin, cos, pi, linspacet
``````

``````plt.plot(0,0, color = 'red', marker = 'o')
``````

``````r = 1.5
angles = linspace(0 * pi, 2 * pi, 100)
print(angles)
xs = cos(angles)
ys = sin(angles)

plt.plot(xs, ys, color = 'green')
plt.xlim(-r, r)
plt.ylim(-r, r)
plt.gca().set_aspect('equal')
``````

## Drawing diameter

``````plt.plot(r-0.5, 0, marker = 'P', color = 'blue')
plt.plot(-r+0.5, 0, marker = 'o', color = 'red')
plt.plot([r, -r], [0, 0], color = 'red')
``````

## A function to convert from Degree to Radian

``````def deg2rad(deg):
return deg * pi / 180
``````

## Now lets draw two lines at 90Β° and 45Β°

``````plt.plot([0, r * cos(deg2rad(90))], [0, r * sin( deg2rad(90))], color = "red")
plt.plot([0, r * cos(deg2rad(45))], [0, r * sin( deg2rad(45))], color = "black")

``````

## Show the final result

``````plt.savefig('angles.png')
``````

Hope that article would save some time.