I am trying to plot a surface and a line which is passing through it. I want to have a plot where the portion of the line which is behind the surface, is hidden.
I tried this in matplotlib but the portion of the line behind the surface is also visible.
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
x = np.arange(0,10,1)
y = np.arange(0,10,1)
z = np.arange(0,10,1)
X, Y = np.meshgrid(x,y)
Z= np.ones((len(x),len(x)))*5
fig = plt.figure()
ax1 = fig.gca(projection='3d')
ax1.plot_surface(X, Y, Z, color='red', edgecolor='black')
ax1.plot(x,y,z,'-',color='black',linewidth=4)
plt.show()