我已经尝试了一个来自matplotlib教程的PolyCollection的例子,并注意到一件奇怪的事情。我无法从轴原点中删除这些点,请参阅图。我如何管理这个?无法删除matplotlib polycollection中的原点
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.collections import PolyCollection
from matplotlib.colors import colorConverter
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
cc = lambda arg: colorConverter.to_rgba(arg, alpha=0.6)
xs = np.arange(5, 10, 0.4)
verts = []
zs = [0.0, 1.0, 2.0, 3.0]
for z in zs:
ys = np.random.rand(len(xs))
ys[0], ys[-1] = 0.1, 0
verts.append(list(zip(xs, ys)))
poly = PolyCollection(verts, facecolors = [cc('r'), cc('g'), cc('b'),
cc('y')])
poly.set_alpha(0.7)
ax.add_collection3d(poly, zs=zs, zdir='y')
ax.set_xlabel('X')
ax.set_xlim3d(0, 10)
ax.set_ylabel('Y')
ax.set_ylim3d(-1, 4)
ax.set_zlabel('Z')
ax.set_zlim3d(0, 1)
plt.show()
气味像一个错误... – tacaswell 2013-04-30 19:00:17
与3D代码的错误,添加到2D轴相同的工作集合给出了预期的结果。 – tacaswell 2013-04-30 19:04:20
,我该如何处理这个错误? – anatoly 2013-05-04 20:19:33