【发布时间】:2017-10-08 05:38:47
【问题描述】:
在 2D 中,我的 x 获取 x 和 y 坐标的值:
x = [[0.72,0.82]]
在代码中的某个时刻,我使用了这个:
plt.plot(x[i][0], x[i][1], 'go', markersize=15, alpha=.5)
现在我有一个 x 来获取 x、y 和 z 坐标的值:
x = [[0.72,0.82,-0.77]]
我现在只想在 3D 中重现 2D 的相同效果,我尝试做类似的事情:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.set_xlim(-1, 1)
ax.set_ylim(-1, 1)
ax.set_zlim(-1, 1)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.scatter(x[i][0], x[i][1], x[i][2], 'go', markersize=15, alpha=.5)
但我收到以下错误:
AttributeError: Unknown property markersize
PS:我正在使用:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
我想知道如何正确绘制它们。
【问题讨论】:
-
据我所知
ax.scatter没有参数markersize -
是的!我知道了,但是我该怎么做呢?
-
你的意思是改变散点大小?
标签: python python-2.7 matplotlib mplot3d