How to draw rays in 3D matplotlib?

-1

Is there a way to plot simply by giving only the radius and coordinates of the center? I found on the internet only filled circles and a way to plot rings with sine and cosine functions, but I do not know how to change the coordinate of the center of the radius or how to plot in other planes. What I found, but I could not change much, was this:

theta = np.linspace(12, (12 +2 *np.pi), 100)
phi = np.linspace(12, (12+ 2*np.pi), 100)
theta, phi = np.meshgrid(theta, phi)
c, a = 10, 0.1
x = (c + a*np.cos(theta)) * np.cos(phi)
y = (c + a*np.cos(theta)) * np.sin(phi)
z = a * np.sin(theta)

fig = plt.figure()
ax1 = fig.add_subplot(111, projection='3d')
ax1.set_zlim(-10,10)
ax1.plot_surface(x, y, z, color='b', edgecolors='b')
ax1.view_init(36, 26)
plt.show()
    
asked by anonymous 04.10.2018 / 21:34

0 answers