Problem:
I am trying to create a wireframe plot and a 3D scatter plot on the same axes in matplotlib, however the scatter plot appears below the wireframe plot even when it should be above it. I tried to change the order of the plotting statements but that did not solve the problem.
Code:
import numpy as np
from matplotlib import pyplot as plt
xgrid, ygrid = np.meshgrid(np.arange(-8, 9, 0.5), np.arange(-8, 9, 0.5))
f = lambda x, y: x**2+y**2
z = f(xgrid, ygrid)
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.scatter3D([0], [0], [150], color="red")
ax.plot_wireframe(xgrid, ygrid, z)
plt.show()
When looking at the graph from above the red dot should be above the wireframe plot, but this code results in the dot being below the graph. It seems that the wireframe is in the foreground at all times.
Red dot below the wireframe plot
Red dot is actually above the wireframe plot
Versions:
Python - 3.8.2
Matplotlib - 3.2.1
Is it possible to fix this problem?
Thank you in advance.