作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下代码使用 ax.plot_surface
显示 3D 表面:
fig = plt.figure()
ax = fig.gca(projection='3d')
X,Y = np.meshgrid(range(k_mean.shape[0]), range(k_mean.shape[1]))
Z = k_mean
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, linewidth=0., alpha=0.8, cmap=cm.nipy_spectral, antialiased=False, shade=False)
cset = ax.contour(X, Y, Z, zdir='z', offset=0, cmap=cm.nipy_spectral)
cset = ax.contour(X, Y, Z, zdir='x', offset=0, cmap=cm.nipy_spectral)
cset = ax.contour(X, Y, Z, zdir='y', offset=120, cmap=cm.nipy_spectral)
ax.set_xlim(0, 120)
ax.set_ylim(0, 120)
ax.set_zlim(0, 1)
fig.colorbar(surf, shrink=0.5, aspect=5)
plt.show()
plt.savefig('3d.pdf', dpi=500)
Spyder 中的绘图显示是“正确的”,但 PDF 似乎忽略了 linewidth=0.
。我该如何解决?
Spyder 输出:
PDF 输出:
最佳答案
matplotlib github 认为这是固定的,但修复没有进入 v1.4.1,但将放入 v1.4.3 https://github.com/matplotlib/matplotlib/issues/2247
关于matplotlib - 将 3D 表面保存为 pdf 时出现黑线 : How can I get rid of them?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29822498/
我是一名优秀的程序员,十分优秀!