使用python實現(xiàn)繪制分布折線圖的示例-創(chuàng)新互聯(lián)

使用python實現(xiàn)繪制分布折線圖的示例?針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

10年積累的成都做網(wǎng)站、網(wǎng)站制作經驗,可以快速應對客戶對網(wǎng)站的新想法和需求。提供各種問題對應的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡服務。我雖然不認識你,你也不認識我。但先網(wǎng)站設計后付款的網(wǎng)站建設流程,更有章丘免費網(wǎng)站建設讓你可以放心的選擇與我們合作。

用Python 繪制分布(折線)圖,使用的是 plot()函數(shù)。

一個簡單的例子:

# 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實現(xiàn)繪制分布折線圖的示例-創(chuàng)新互聯(lián)
路徑分享:http://www.bm7419.com/article38/dgcgsp.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供電子商務、自適應網(wǎng)站、網(wǎng)站維護、網(wǎng)站改版網(wǎng)站內鏈、網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

h5響應式網(wǎng)站建設