使用python實(shí)現(xiàn)繪制分布折線圖的示例?針對(duì)這個(gè)問(wèn)題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問(wèn)題的小伙伴找到更簡(jiǎn)單易行的方法。
用Python 繪制分布(折線)圖,使用的是 plot()函數(shù)。
一個(gè)簡(jiǎn)單的例子:
# 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軸標(biāo)簽 plt.xlabel("clusters") plt.ylabel("number of reviews") # Y軸標(biāo)簽 plt.title("A simple plot") # 標(biāo)題 plt.show()
分享題目:使用python實(shí)現(xiàn)繪制分布折線圖的示例-創(chuàng)新互聯(lián)
路徑分享:http://www.rwnh.cn/article38/dgcgsp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、自適應(yīng)網(wǎng)站、網(wǎng)站維護(hù)、網(wǎng)站改版、網(wǎng)站內(nèi)鏈、網(wǎng)站收錄
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容