python画出分布图的方法

小编给大家分享一下python画出分布图的方法,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨方法吧!

成都服务器托管,创新互联提供包括服务器租用、简阳服务器托管、带宽租用、云主机、机柜租用、主机租用托管、CDN网站加速、国际域名空间等业务的一体化完整服务。电话咨询:18982081108

python画分布图代码示例:

# encoding=utf-8
import matplotlib.pyplot as plt
from pylab import *  # 支持中文

mpl.rcParams['font.sans-serif'] = ['SimHei']
# 'mentioned0cluster',
names = ['mentioned1cluster','mentioned2cluster', 'mentioned3cluster', 'mentioned4cluster', 'mentioned5cluster', 'mentioned6cluster', 'mentioned7cluster', 'mentioned8cluster', 'mentioned9cluster', 'mentioned10cluster']
x = range(len(names))
# y_0625 = [39266,56796,42996,24872,13849,8609,5331,1971,554,169,26]

y_0626_1=[4793,100,0,0,0,0,0,0,0,0]
# y_0626_2=[2622,203,0,0,0,0,0,0,0,0,0]

# plt.plot(x, y, 'ro-')
# plt.plot(x, y1, 'bo-')
# pl.xlim(-1, 11) # 限定横轴的范围
# pl.ylim(-1, 110) # 限定纵轴的范围
plt.plot(x, y_0626_1, marker='o', mec='r', mfc='w', label='HighRating:MentionedClusterNum Distribution')
# plt.plot(x, y_0626_2, marker='o', mec='r', mfc='w', label='LowRating:MentionedClusterNum Distribution')
# plt.plot(x, y1, marker='*', ms=10, label=u'y=x^3曲线图')
plt.legend()  # 让图例生效
plt.xticks(x, names, rotation=45)
plt.margins(0)
plt.subplots_adjust(bottom=0.15)
# plt.xlabel(u"time(s)邻居")  # X轴标签
plt.xlabel("clusters")
plt.ylabel("number of reviews")  # Y轴标签
plt.title("A simple plot")  # 标题

plt.show()

效果如下:

python画出分布图的方法

python画分布图的思路:

先在列表中定义分布图x、y轴的数值,然后使用plt.plot()方法即可将分布图绘制出来。

看完了这篇文章,相信你对python画出分布图的方法有了一定的了解,想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!

新闻标题:python画出分布图的方法
网站地址:https://www.cdcxhl.com/article4/ghsgoe.html

成都网站建设公司_创新互联,为您提供网页设计公司静态网站动态网站网站改版网站排名商城网站

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都定制网站网页设计