python-3.x - python 3 散点图给出 "ValueError: Masked arrays must be 1-D"即使我没有使用任何掩码数组

标签 python-3.x matplotlib scatter

我正在尝试使用下面的 .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/

相关文章:

python - 绘制具有不同日期的两个时间序列的值

Python matplotlib blit 并更新文本

python - 为什么我的 Python 散点图不起作用?

python - Matplotlib 散点图,在子图中具有标准化颜色图

python - 尝试使用 Colorama 时出现 AttributeError(我知道这不是一个好标题)

python - 如何找到python中有多少个单词?

python - 为图像着色 Pygame

python - 当我尝试从列表中删除变量时,remove() 返回 None

python - 创建 seaborn 热图时 'could not convert string to float' ValueError

tableau-api - 在 Power BI 中制作散点图