栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python(6):ValueError:Using a string of single character colors as a color sequence is not supported.

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python(6):ValueError:Using a string of single character colors as a color sequence is not supported.

ValueError: Using a string of single character colors as a color sequence is not supported. The colors can be passed as an explicit list instead.

运行程序出现上面的报错,修改后的代码如下:

    # pl.scatter(X[ones_, 0], X[ones_, 1], c='r', cmap='jet', s=5, edgecolors='')
    pl.scatter(X[ones_, 0], X[ones_, 1], c='r', cmap='jet', s=5, edgecolors='none')


    # pl.scatter(X_query[:, 0], X_query[:, 1], c=Y_query, cmap='jet', s=10, marker='8',edgecolors='')
    pl.scatter(X_query[:, 0], X_query[:, 1], c=Y_query, cmap='jet', s=10, marker='8',edgecolors='none')
解决办法:

(1)将edgecolor参数对应内容去掉即可

stackflow原话如下

Just remove the edgecolor='' from ax.scatter(x, y, c=z, s=50, edgecolor='') and it will plot.

(2)将edgecolor=''替换为edgecolor='none'

stackflow原话如下

You can use edgecolor='none' for a fully transparent edge. Or linewidths=0. Default the edgecolor is equal to the facecolor. With very small dots it can help to remove the edge, but for s=50 there doesn't seem to be a lot of benefits.

参考:

python - Colour points in scatter plot based on density - Stack Overflow

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/942486.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号