0

I'm trying to plot the trajectory of a photon orbiting a black hole. I'd like the photon to go behind the black hole and then in front of it (stable circular orbit). However I can't plot that, my photon is either in the foreground or in the background.

I've tried using zorder but it didn't work

fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.set_aspect('equal')

# black surface
u = np.linspace(0, 2*np.pi, 100)
v = np.linspace(0, 2*np.pi, 100)

x = rs * np.outer(np.cos(u), np.sin(v))
y = rs * np.outer(np.sin(u), np.sin(v))
z = rs * np.outer(np.ones(np.size(u)), np.cos(v))

# plot black sphere
ax.plot_surface(x, y, z, rstride=4, cstride=4, color='k', zorder=6)

# plot trajectories (photons)
ax.plot(X0, Y0, Z0, 'r', zorder=6)
ax.plot(X1, Y1, Z1, 'b', zorder=5)
ax.plot(X2, Y2, Z2, 'g', zorder=4)
ax.plot(X3, Y3, Z3, 'fuchsia', zorder=3)
ax.plot(X4, Y4, Z4, 'turquoise', zorder=2)


plt.show()

I'd like to have a sphere with photons orbiting it. I'd like to see that the surface is a 3D sphere and not a circle, that is: I'd like the photons to go behind the surface when actually behind and in front of it when actually in front. Can anyone please help me?

  • [How to obscure a line behind a surface plot in matplotlib?](https://stackoverflow.com/questions/41699494/how-to-obscure-a-line-behind-a-surface-plot-in-matplotlib) – ImportanceOfBeingErnest Jul 22 '19 at 20:24
  • @ImportanceOfBeingErnest I already tried using this method, it didn't work. Got any suggestions? Please I would really appreciate some help right now :) – poissonrouge Jul 22 '19 at 20:31
  • I don't think I can explain it any better than in the linked answer, sorry. – ImportanceOfBeingErnest Jul 22 '19 at 20:37
  • It would be very helpful for others trying to help you if your code snipped was complete, right now there's a lot of missing variables if I try to execute it. – Freya W Jul 22 '19 at 21:16

0 Answers0