Edit: the problem I describe here no longer shows with current versions of matplotlib (2.1.1, edit made on 10 Sep 2019): most certainly a bug that has been fixed since then
I want to have a line plot (drawn with Axis.plot()
) that is partially covered by the surface generated by Axis.plot_surface()
. I wrote the following script:
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
resolution = 100
ax = plt.gca(projection="3d")
x, y = np.meshgrid( np.linspace(-1.0, 1.0, resolution) ,
np.linspace(-1.0, 1.0, resolution) )
phi = (1.0 - x)*(1.0 - y) / 4.0
ax.plot([-1.0,1.0], [-1.0,1.0], [0.0,0.0], color="red")
ax.plot_surface(x, y, phi, linewidth=0, antialiased=False)
plt.show()
and made sure to have the call to plot()
before the one to plot_surface()
. Nevertheless, it seems that the line plot always has the highest "zindex" and gets plotted over the surface. Here is what I obtain:
Here is what I would like to have instead:
How do I achieve this result? (Without using Gimp…)