以下代码

plt.scatter(X[0, :], X[1, :], c=y, cmap=plt.cm.Spectral)

报错:

ValueError: RGBA sequence should have length 3 or 4During handling of the above exception, another exception occurred:......ValueError: 'c' argument has 1 elements, which is not acceptable for use with 'x' with size 300, 'y' with size 300.

修改为:

import operator
from functools import reduceplt.scatter(X[0, :], X[1, :], c=reduce(operator.add, y), cmap=plt.cm.Spectral)

即可解决

关于“‘c‘ argument has 1 elements, which is not acceptable for use with ‘x‘ with size 300“的解决办法相关推荐

  1. -bash: /bin/rm: Argument list too long的解决办法

    -bash: /bin/rm: Argument list too long的解决办法 当目录下文件太多时,用rm删除文件会报错: -bash: /bin/rm: Argument list too ...

  2. pycharm 黄色(黄字)高亮警告 Default argument value is mutable 原因及解决办法(mutable 可变对象与 immutable不可变对象)

    示例 解决方案 按照参考文章的意思,classes=read_class_names(cfg.YOLO.CLASSES)在函数调用时就会创建对象并赋初始值,如果在函数中修改了classes的值,则函数 ...

  3. TypeError: __init__() got an unexpected keyword argument ‘任意数‘的原因及解决办法

    本篇文章主要讲解 pymysql模块查询数据时报错 "TypeError: init() got an unexpected keyword argument '任意数'的原因及解决办法&q ...

  4. TypeError: argument 1 has unexpected type 'NoneType'(解决办法)

    self.search.clicked.connect(self.search_information(e)) 在使用connect时,报TypeError: argument 1 has unexp ...

  5. 错误“checking build system type... config.sub: missing argument”的解决办法

    背景:交叉编译avahi库时遇到错误"checking build system type... config.sub: missing argument" ,"conf ...

  6. latex出现runaway argument?错误的解决办法

    早上在修改编译论文时发现了这个问题,仔细检查代码并没发现错误,一时也找不到具体的解决办法.我一直以为是因为runaway argument的错误提示,可实际上就是因为aux文件没有完整输入,导致上次编 ...

  7. Validation failed for argument [0] 参数校验失败的解决办法

    问题概述 关于这个问题,是在接口参数校验的时候遇到的,使用Spring Boot下spring-boot-starter-validation进行接口参数校验时出现 "  Validatio ...

  8. Python OSError: [Errno 22] Invalid argument:的解决办法

    今天在用到open函数时,始终报OSError: [Errno 22] Invalid argument:的错误,发现解决办法有以下几种: 方法一:输入格式错误 f = open('F:\Python ...

  9. 有道报出: Encountered an improper argument解决办法

    概述 出现的症状:在打开有道云之后使用划词翻译第一次可以使用之后就不能使用了,报出Encountered an improper argument 截图当时没截上百度截上来了 up主的解决办法是: 看 ...

最新文章

  1. 查看python安装路径
  2. RHCE课程-RH253Linux服务器架设笔记五-DNS服务器配置(2)
  3. css3 画半圆和1/4圆
  4. 牛客 数素数 (20)
  5. APK加壳【1】初步方案实现详解
  6. 多个python文件相互调用_用 python提取两个文件之间的内容
  7. android动态显示键盘,动态修改EditText输入键盘并隐藏或显示密码
  8. HYSBZ - 2243染色——树链剖分+线段树建树技巧
  9. python sqlite3事务_python使用上下文管理器实现sqlite3事务机制
  10. Pytorch 版YOLOV5训练自己的数据集
  11. Rabbitmq工作笔记009---access to vhost ‘/‘ refused for user 权限问题
  12. struts2 标签单选框_Struts 2 UI标签–表单,复选框,单选,选择,提交
  13. 深度学习自学(七):腾讯移动端开源框架ncnn学习总结
  14. Ubuntu 12.04 MTK环境配置说明
  15. unity使用BMFont制作位图字体
  16. MD5在线解密工具推荐
  17. SPI FLASH 波形测量演示实例
  18. java学习day10(Java基础)特殊类
  19. JVM学习笔记(12) 垃圾回收-垃圾回收相关算法
  20. GYM 101350E. Competitive Seagulls (博弈

热门文章

  1. 2021年中国航天发射列表(55发见证历史)
  2. 队列--先进先出的线性表
  3. 同期收治患者住院天数_速看!二级公立中医医院绩效考核指标发布(附34个指标)...
  4. Redhat7(centos7)及以上防火墙完整介绍
  5. 机器学习中使用的独热编码
  6. Matlab图像处理入门教程(菜鸟级)
  7. jekins相关资料
  8. 笔记本计算机半角数字切换,半角字符怎么输入?如何切换为-全角字符
  9. 第一章: Optix光线跟踪引擎简介
  10. 一个H.265/HEVC码流分析工具