我正在尝试使用下面的 .scatter 方法绘制散点图。这里ax.scatter(X[:,0], X[:,1], c = colors, marker = 'o', s=80, edgecolors = 'none')
输入/参数类如下:X[:,0]] type: <class 'numpy.matrixlib.defmatrix.matrix'>
X[:,1]] type: <class 'numpy.matrixlib.defmatrix.matrix'>
colors type: <class 'list'>
但是python抛出了一个值错误,如下所示:
error image
最佳答案
把东西放在括号里:
plt.scatter([X[:,0]],[X[:,1]])
关于python-3.x - python 3 散点图给出 "ValueError: Masked arrays must be 1-D"即使我没有使用任何掩码数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44224076/