【发布时间】:2018-01-20 10:54:26
【问题描述】:
我有以下代码可以生成曲面图,但它并没有达到我的预期。
xx, yy = np.meshgrid(dealer_sums, player_sums)
def getter(dealer_sum, player_sum):
state = (dealer_sum, player_sum)
return self.get_value(state)
z = np.vectorize(getter)
zz = z(xx,yy)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(xx,yy, zz)
仅供参考,xx、yy 和 zz 的形状都是相等的,并且是 2D 的。
从查看有关此的其他帖子(surface plots in matplotlib;Simplest way to plot 3d surface given 3d points)看来,一个常见的问题是 x 和 y 坐标是不规则的,但如果我理解正确,我认为我的已经通过打电话给np.meshgrid?
我在下面提供了一个散点图来显示数据在没有表面的情况下的样子:
这就是调用plot_wireframe 的样子:
我画了几条我没想到的线。我的问题是,是否有可能摆脱这些线条并创建一个看起来像这样的表面?
感谢您的帮助。
【问题讨论】:
标签: python python-2.7 matplotlib plot