Python使用matplotlib 模块scatter方法画散点图示例

Python使用matplotlib 模块scatter方法画散点图示例,第1张

概述Python使用matplotlib 模块scatter方法画散点图示例 本文实例讲述了Python使用matplotlib 模块scatter方法画散点图.分享给大家供大家参考,具体如下: # -*-coding:utf-8-*- import matplotlib.pyplot as plt y = [12, 7, 1, 2, 6, 3, 7, 5, 12, 6, 14, 10, 6, 7, 1, 2, 9, 3, 4, 4, 4, 5, 4, 6, 9, 5, \ 2, 1, 2, 1, 7, 6, 43, 15, 18, 52, 39, 53, 39, 17,

本文实例讲述了Python使用matplotlib 模块scatter方法画散点图。分享给大家供大家参考,具体如下:

# -*-@R_419_5563@:utf-8-*-import matplotlib.pyplot as plty = [12,7,1,2,6,3,5,12,14,10,9,4,\  2,43,15,18,52,39,53,17,28,59,20,49,\  44,41,72,31,40,50,65,100,42,110,86,76,88,62,50]print(len(y))x = []for i in range(0,len(y)): #x and y must be the same size  x.append(i*5)plt.scatter(x,y,s=16,c = 'r',marker = 'o')#设置标题并加上轴标签plt.Title("Numbers",Fontsize=12)plt.xlabel("X",Fontsize=12)plt.ylabel("Y",Fontsize=12)#设置刻度标记的大小plt.tick_params(axis='both',which='major',labelsize=10)#设置每个坐标的取值范围plt.axis([0,380,180])plt.show()

更多关于Python相关内容感兴趣的读者可查看本站专题:《Python数学运算技巧总结》、《Python数据结构与算法教程》、《Python函数使用技巧总结》、《Python字符串 *** 作技巧汇总》及《Python入门与进阶经典教程》

希望本文所述对大家Python程序设计有所帮助。

总结

以上是内存溢出为你收集整理的Python使用matplotlib 模块scatter方法画散点图示例全部内容,希望文章能够帮你解决Python使用matplotlib 模块scatter方法画散点图示例所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/langs/1199764.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存