我正在尝试将图例添加到 3d 条,但没有成功。
我收到错误:
AttributeError: 'Patch3D' object has no attribute '_facecolor2d'
复制的最小代码: from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
for z in [10, 0]:
xs = np.arange(20)
ys = np.random.rand(20)
ax.bar(xs, ys, zs=z, zdir='y', label=str(z))
ax.legend()
plt.show()
如何将图例添加到 3d 条?