第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > python matplotlib 散点图_python matplotlib散点图颜色

python matplotlib 散点图_python matplotlib散点图颜色

时间:2021-01-07 05:55:13

相关推荐

python matplotlib 散点图_python matplotlib散点图颜色

我试图用x和y网格创建散点图,其中每个点通过预先指定的值获得颜色:{x: 1, y: 2, value: n}

我有一个x和y的列表和另一个值列表,尝试使用这个:

^{pr2}$

错误:Traceback (most recent call last):

File "C:\python3.6.6\lib\site-packages\matplotlib\colors.py", line 158, in to_rgba

rgba = _colors_full_map.cache[c, alpha]

KeyError: (1.0986122886681098, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\python3.6.6\lib\site-packages\matplotlib\axes\_axes.py", line 4210, in scatter

colors = mcolors.to_rgba_array(c)

File "C:\python3.6.6\lib\site-packages\matplotlib\colors.py", line 259, in to_rgba_array

result[i] = to_rgba(cc, alpha)

File "C:\python3.6.6\lib\site-packages\matplotlib\colors.py", line 160, in to_rgba

rgba = _to_rgba_no_colorcycle(c, alpha)

File "C:\python3.6.6\lib\site-packages\matplotlib\colors.py", line 211, in _to_rgba_no_colorcycle

raise ValueError("Invalid RGBA argument: {!r}".format(orig_c))

ValueError: Invalid RGBA argument: 1.0986122886681098

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:/Users/amit neumark/Documents/עמית/alpha/grbs data/grbs/find_burst_location.py", line 168, in

main()

File "C:/Users/amit neumark/Documents/עמית/alpha/grbs data/grbs/find_burst_location.py", line 161, in main

ra2, dec2 = chi_square(model, relations)

File "C:/Users/amit neumark/Documents/עמית/alpha/grbs data/grbs/find_burst_location.py", line 33, in chi_square

create_plot(sums)

File "C:/Users/amit neumark/Documents/עמית/alpha/grbs data/grbs/find_burst_location.py", line 134, in create_plot

plt.scatter(x, y, c=colors)

File "C:\python3.6.6\lib\site-packages\matplotlib\pyplot.py", line 2793, in scatter

verts=verts, edgecolors=edgecolors, data=data, **kwargs)

File "C:\python3.6.6\lib\site-packages\matplotlib\__init__.py", line 1785, in inner

return func(ax, *args, **kwargs)

File "C:\python3.6.6\lib\site-packages\matplotlib\axes\_axes.py", line 4223, in scatter

.format(nc=n_elem, xs=x.size, ys=y.size)

ValueError: 'c' argument has 64800 elements, which is not acceptable for use with 'x' with size 64800, 'y' with size 64800.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。