python用matplotlib中c和cmap的使用

在python从入门到实践一书的学习中,对scatter方法中c和cmap的用法有疑惑,c和cmap一起用的时候,到底c应该怎么确定?下面的代码是书中给的,c=point_numbers,也就是range(0,5000)的列表,但我发现写c=x_values,效果也是一样的,应该遵循什么特定规则吗?



```python

import matplotlib.pyplot as plt
from random_walk import RandomWalk

while True:
    rw=RandomWalk()
    rw.fill_walk()
    point_numbers=list(range(rw.num_points))
    plt.scatter(rw.x_values, rw.y_values, c=point_numbers,
        cmap=plt.cm.Blues, edgecolor = 'none', s=15)
    plt.show()
    
    keep_running = input("Make another walk?(y/n): ")
    if keep_running == 'n':
        break

```

plt.scatter中c参数和cmap参数的区别是什么?-SofaSofa http://www.sofasofa.io/forum_main_post.php?postid=1007596