In this blog, we will plot point at origin then circle. After that we will plot diameter, radius, arc and segment(chord) using matplotlib library.
A circle is a shape consisting of all points in a plane that are at a given distance from a given point, the centre; equivalently it is the curve traced out by a point that moves in a plane so that its distance from a given point is constant. The distance between any point of the circle and the centre is called the radius.
the distance around the circle.
the point equidistant from all points on the circle.
Diameter a line segment whose endpoints lie on the circle and that passes through the centre; or the length of such a line segment. This is the largest distance between any two points on the circle.
The distance between any point of the circle and the centre is called the radius.
any connected part of a circle. Specifying two end points of an arc and a center allows for two arcs that together make up a full circle.
a line segment whose endpoints lie on the circle, thus dividing a circle into two segments.
import matplotlib.pyplot as plt
import numpy as np
from numpy import sin, cos, pi, linspace
#draw point at origin (0, 0)
plt.plot(0,0, color = 'red', marker = 'o')
plt.show()
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 + 0.1, 0 + 0.1), fontsize=10)
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
angles = linspace(0 * pi, 2 * pi, 100 )
print(angles)
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 + 0.1, 0 + 0.1), xycoords='data', fontsize=10)
angles = linspace(0 * pi, 2 * pi, 100 )
xs = cos(angles)
ys = sin(angles)
plt.plot(xs, ys, color = 'green')
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 + 0.1, 0 + 0.1), xycoords='data', fontsize=10)
angles = linspace(0 * pi, 2 * pi, 100 )
r = 1.5
xs = r * cos(angles)
ys = r * sin(angles)
plt.plot(xs, ys, color = 'green')
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
#draw point at orgin
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 + 0.1, 0 + 0.1), xycoords='data', fontsize=10)
#draw circle
angles = linspace(0 * pi, 2 * pi, 100 )
r = 1.5
xs = r * cos(angles)
ys = r * sin(angles)
plt.plot(xs, ys, color = 'green')
#draw daimeter
plt.plot(1.5, 0, marker = 'o', color = 'blue')
plt.plot(-1.5, 0, marker = 'o', color = 'blue')
plt.plot([1.5, -1.5], [0, 0])
plt.gca().annotate('Diameter', xy=(-0.5, -0.25), xycoords='data', fontsize=10)
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
#draw point at orgin
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 + 0.1, 0 + 0.1), xycoords='data', fontsize=10)
#draw circle
angles = linspace(0 * pi, 2 * pi, 100 )
r = 1.5
xs = r * cos(angles)
ys = r * sin(angles)
plt.plot(xs, ys, color = 'green')
#draw daimeter
plt.plot(0, 1.5, marker = 'o', color = 'blue')
plt.plot(0, -1.5, marker = 'o', color = 'blue')
plt.plot([0, 0], [1.5, -1.5])
plt.gca().annotate('Diameter', xy=(-0.25, -0.25), xycoords='data', fontsize=10, rotation = 90)
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
#draw point at orgin
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 + 0.1, 0 + 0.1), xycoords='data', fontsize=10)
#draw circle
r = 1.5
angles = linspace(0 * pi, 2 * pi, 100 )
xs = r * cos(angles)
ys = r * sin(angles)
plt.plot(xs, ys, color = 'green')
#draw daimeter
plt.plot(0, 1.5, marker = 'o', color = 'blue')
plt.plot(0, -1.5, marker = 'o', color = 'blue')
plt.plot([0, 0], [1.5, -1.5])
plt.gca().annotate('Diameter', xy=(-0.25, -0.25), xycoords='data', fontsize=10, rotation = 90)
#draw radius
plt.plot(0, 0, marker = 'o', color = 'purple')
plt.plot(1.5, 0, marker = 'o', color = 'purple')
plt.plot([0, 1.5], [0, 0], color = 'purple')
plt.gca().annotate('Radius', xy=(0.5, -0.2), xycoords='data', fontsize=10)
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
#draw point at orgin
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 + 0.1, 0 + 0.1), xycoords='data', fontsize=10)
#draw circle
r = 1.5
angles = linspace(0 * pi, 2 * pi, 100 )
xs = r * cos(angles)
ys = r * sin(angles)
plt.plot(xs, ys, color = 'green')
#draw daimeter
plt.plot(0, 1.5, marker = 'o', color = 'blue')
plt.plot(0, -1.5, marker = 'o', color = 'blue')
plt.plot([0, 0], [1.5, -1.5])
plt.gca().annotate('Diameter', xy=(-0.25, -0.25), xycoords='data', fontsize=10, rotation = 90)
#draw radius
plt.plot(0, 0, marker = 'o', color = 'purple')
plt.plot(1.5, 0, marker = 'o', color = 'purple')
plt.plot([0, 1.5], [0, 0], color = 'purple')
plt.gca().annotate('Radius', xy=(0.5, -0.2), xycoords='data', fontsize=10)
#draw arc
arc_angles = linspace(0 * pi, pi/4, 20)
arc_xs = r * cos(arc_angles)
arc_ys = r * sin(arc_angles)
plt.plot(arc_xs, arc_ys, color = 'red', lw = 3)
plt.gca().annotate('Arc', xy=(1.5, 0.4), xycoords='data', fontsize=10, rotation = 120)
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
plt.figure(figsize = (18, 7))
#draw point at orgin
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 + 0.1, 0 + 0.1), xycoords='data', fontsize=10)
#draw circle
r = 1.5
angles = linspace(0 * pi, 2 * pi, 100 )
xs = r * cos(angles)
ys = r * sin(angles)
plt.plot(xs, ys, color = 'green')
#draw daimeter
plt.plot(0, 1.5, marker = 'o', color = 'blue')
plt.plot(0, -1.5, marker = 'o', color = 'blue')
plt.plot([0, 0], [1.5, -1.5])
plt.gca().annotate('Diameter', xy=(-0.25, -0.25), xycoords='data', fontsize=10, rotation = 90)
#draw radius
#plt.plot(0, 0, marker = 'o', color = 'purple')
plt.plot(1.5, 0, marker = 'o', color = 'purple')
plt.plot([0, 1.5], [0, 0], color = 'purple')
plt.gca().annotate('Radius', xy=(0.5, -0.2), xycoords='data', fontsize=10)
#draw arc
arc_angles = linspace(0 * pi, pi/4, 20)
arc_xs = r * cos(arc_angles)
arc_ys = r * sin(arc_angles)
plt.plot(arc_xs, arc_ys, color = 'red', lw = 3)
plt.gca().annotate('Arc', xy=(1.5, 0.4), xycoords='data', fontsize=10, rotation = 120)
#draw another radius
plt.plot(r * cos(pi /4), r * sin( pi / 4), marker = 'o', color = 'red')
plt.plot([0, r * cos(pi /4)], [0, r * sin( pi / 4)], color = "purple")
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
plt.figure(figsize = (18, 7))
#draw point at orgin
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 - 0.1, 0 + 0.1), xycoords='data', fontsize=10)
#draw circle
r = 1.5
angles = linspace(0 * pi, 2 * pi, 100 )
xs = r * cos(angles)
ys = r * sin(angles)
plt.plot(xs, ys, color = 'green')
#draw daimeter
plt.plot(0, 1.5, marker = 'o', color = 'blue')
plt.plot(0, -1.5, marker = 'o', color = 'blue')
plt.plot([0, 0], [1.5, -1.5])
plt.gca().annotate('Diameter', xy=(-0.25, -0.25), xycoords='data', fontsize=10, rotation = 90)
#draw radius
#plt.plot(0, 0, marker = 'o', color = 'purple')
plt.plot(1.5, 0, marker = 'o', color = 'purple')
plt.plot([0, 1.5], [0, 0], color = 'purple')
plt.gca().annotate('Radius', xy=(0.5, -0.2), xycoords='data', fontsize=10)
#draw arc
arc_angles = linspace(0 * pi, pi/4, 20)
arc_xs = r * cos(arc_angles)
arc_ys = r * sin(arc_angles)
plt.plot(arc_xs, arc_ys, color = 'red', lw = 3)
#plt.gca().annotate('Arc', xy=(1.5, 0.4), xycoords='data', fontsize=10, rotation = 120)
plt.gca().annotate(r'Arc = r * $\theta$', xy=(1.3, 0.4), xycoords='data', fontsize=10, rotation = 120)
#draw another radius
plt.plot(r * cos(pi /4), r * sin( pi / 4), marker = 'o', color = 'red')
plt.plot([0, r * cos(pi /4)], [0, r * sin( pi / 4)], color = "purple")
# draw theta angle
r1 = 0.5
arc_angles = linspace(0 * pi, pi/4, 20)
arc_xs = r1 * cos(arc_angles)
arc_ys = r1 * sin(arc_angles)
plt.plot(arc_xs, arc_ys, color = 'green', lw = 3)
plt.gca().annotate(r'$\theta$', xy=(0.5, 0.2), xycoords='data', fontsize=15, rotation = 90)
plt.gca().annotate('<----- r = 1.5 ---->', xy=(0 - 0.2, 0 + 0.2), xycoords='data', fontsize=15, rotation = 45)
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()
plt.figure(figsize = (18, 7))
#draw point at orgin
plt.plot(0,0, color = 'red', marker = 'o')
plt.gca().annotate('O (0, 0)', xy=(0 - 0.1, 0 + 0.1), xycoords='data', fontsize=10)
#draw circle
r = 1.5
angles = linspace(0 * pi, 2 * pi, 100 )
xs = r * cos(angles)
ys = r * sin(angles)
plt.plot(xs, ys, color = 'green')
#draw daimeter
plt.plot(0, 1.5, marker = 'o', color = 'blue')
plt.plot(0, -1.5, marker = 'o', color = 'blue')
plt.plot([0, 0], [1.5, -1.5])
plt.gca().annotate('Diameter', xy=(-0.25, -0.25), xycoords='data', fontsize=10, rotation = 90)
#draw radius
#plt.plot(0, 0, marker = 'o', color = 'purple')
plt.plot(1.5, 0, marker = 'o', color = 'purple')
plt.plot([0, 1.5], [0, 0], color = 'purple')
plt.gca().annotate('Radius', xy=(0.5, -0.2), xycoords='data', fontsize=10)
#draw arc
arc_angles = linspace(0 * pi, pi/4, 20)
arc_xs = r * cos(arc_angles)
arc_ys = r * sin(arc_angles)
plt.plot(arc_xs, arc_ys, color = 'red', lw = 3)
#plt.gca().annotate('Arc', xy=(1.5, 0.4), xycoords='data', fontsize=10, rotation = 120)
plt.gca().annotate(r'Arc = r * $\theta$', xy=(1.3, 0.4), xycoords='data', fontsize=10, rotation = 120)
#draw another radius
plt.plot(r * cos(pi /4), r * sin( pi / 4), marker = 'o', color = 'red')
plt.plot([0, r * cos(pi /4)], [0, r * sin( pi / 4)], color = "purple")
# draw theta angle and annotation
r1 = 0.5
arc_angles = linspace(0 * pi, pi/4, 20)
arc_xs = r1 * cos(arc_angles)
arc_ys = r1 * sin(arc_angles)
plt.plot(arc_xs, arc_ys, color = 'green', lw = 3)
plt.gca().annotate(r'$\theta$', xy=(0.5, 0.2), xycoords='data', fontsize=15, rotation = 90)
plt.gca().annotate('<----- r = 1.5 ---->', xy=(0 - 0.2, 0 + 0.2), xycoords='data', fontsize=15, rotation = 45)
#draw segment
r2 = 1.5
segment_angles = linspace(3/4 * 2* pi, 2 * pi, 100 )
segment_xs = r2 * cos(segment_angles)
segment_ys = r2 * sin(segment_angles)
plt.plot(segment_xs, segment_ys, color = 'yellow')
plt.plot([1.5, 0], [0, -1.5], color = 'yellow')
plt.gca().annotate('Segment', xy=(0.5, -1.2), xycoords='data', fontsize=15, rotation = 45)
seg_x_p1 = r2 * cos(2 * pi)
plt.xlim(-2, 2)
plt.ylim(-2, 2)
plt.gca().set_aspect('equal')
plt.show()