我正在使用 mpl_toolkits 使用 Axes3D 和plot_surface 在 3d 中绘制曲面。
I visualize the output in the following way,
![enter image description here](https://i.stack.imgur.com/wzTmn.png)
当颜色应该类似于右侧的颜色条时,您可以清楚地看到整个表面有灰色调。
我在其他几个做类似事情的情节中看到了这种行为。例如这里https://stackoverflow.com/a/20475233/2495342 https://stackoverflow.com/a/20475233/2495342
我正在使用最新的 anaconda python 发行版,并在使用 Qt4Agg 后端的spyder 中运行我的代码。我在 Linux 和 Windows 下得到相同的行为。使用不同的颜色图也没有帮助。可视化始终呈灰色。
我没有通过谷歌找到太多帮助,因此非常感谢任何帮助。
这是一个快速演示
import numpy as np
from matplotlib import pyplot
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
X, Y = np.meshgrid(np.arange(-1, 1, 0.1), np.arange(-1, 1, 0.1))
Z = np.zeros_like(X)
F = np.sqrt(X**2 + Y**2)
F -= np.min(F)
F /= np.max(F)
fig = pyplot.figure()
ax = fig.gca(projection='3d')
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, facecolors=cm.coolwarm(F))
哪个返回