Tôi đã thử một ví dụ với PolyCollection từ hướng dẫn matplotlib và nhận thấy một điều kỳ lạ. Tôi không thể loại bỏ điểm này từ gốc rìu xem hình. Làm thế nào để quản lý điều này?không thể xóa điểm gốc trong 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()
có mùi giống như một lỗi ... – tacaswell
Lỗi với mã 3D, thêm bộ sưu tập mưu đồ tương tự vào trục 2D cho kết quả mong đợi. – tacaswell
và tôi nên làm gì với lỗi này? – anatoly