自定义颜色

自定义颜色

import matplotlib.pyplot as plt

x_values = range(1,1001)
y_values = [x ** 2 for x in x_values]
fig,ax = plt.subplots()
ax.scatter(x_values,y_values,s=100,c='pink')    # 设置颜色,可以通过元组设置rgb,如c=(0,0.8,0)
ax.axis([0,1100,0,1100000])
plt.show()

  

 

 

颜色映射(colormap)

import matplotlib.pyplot as plt

x_values = range(1,1001)
y_values = [x ** 2 for x in x_values]
fig,ax = plt.subplots()
ax.scatter(x_values,y_values,s=100,c=y_values,cmap=plt.cm.Blues)
ax.axis([0,1100,0,1100000])
plt.show()

  

 

posted on 2021-03-14 00:05  winecork  阅读(125)  评论(0编辑  收藏  举报

导航