In [1]:
import numpy as np
import matplotlib.pyplot as plt
# %matplotlib widget
In [2]:
origin = np.array([0, 0, 0])
angle = np.linspace(0, 2*np.pi, 50)
radius = 3
center_of_ring = np.array([0, 0, 0])
In [3]:
X_ring = radius*np.cos(angle) + center_of_ring[0]
Y_ring = radius*np.sin(angle) + center_of_ring[1]
Z_ring = angle * 0 + center_of_ring[2]
In [4]:
fig = plt.figure(figsize = (6, 6))
ax = plt.axes(projection='3d', box_aspect = (1, 1, 1))
#origin
ax.plot(*origin, color = 'red', marker = 'o')
ax.text(origin[0] + 0.25, origin[1] + 0.25, origin[2] + 0.25, s = '$O$', fontsize = 12)
#plot ring
ax.plot(X_ring, Y_ring, Z_ring, color = 'blue')
ax.set_xlim(-5, 5)
ax.set_ylim(-5, 5)
ax.set_zlim(-5, 5)
plt.grid()
# plt.axis('off')
# interact(update)
In [ ]: