之前写过一篇,使用magic function快速绘图的教程了:https://www.cnblogs.com/jiading/p/11750001.html。但这种方法比较适合用来绘制柱状图,散点图的话,使用下面的代码:

import matplotlib.pyplot as plt
X=[-1,0,1,2,3,4,-4,8,2,0,-2]
y=[0,1,2,3,4,5,6,7,8,9,10]
count=len(X)
for i in range(count):
    plt.scatter(X,y,c=y,cmap=plt.cm.Reds)
plt.show()

画出来就是:

# 使用scatter()绘制散点图

相关文章:

  • 2022-01-19
  • 2021-12-05
  • 2021-06-02
  • 2021-05-30
  • 2022-01-27
  • 2022-01-17
  • 2022-02-08
  • 2021-06-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-07-16
  • 2022-12-23
相关资源
相似解决方案