溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Python數(shù)據(jù)可視化圖實(shí)現(xiàn)過(guò)程分析

發(fā)布時(shí)間:2020-06-23 10:55:14 來(lái)源:億速云 閱讀:190 作者:清晨 欄目:開(kāi)發(fā)技術(shù)

不懂Python數(shù)據(jù)可視化圖實(shí)現(xiàn)過(guò)程分析?其實(shí)想解決這個(gè)問(wèn)題也不難,下面讓小編帶著大家一起學(xué)習(xí)怎么去解決,希望大家閱讀完這篇文章后大所收獲。

python畫(huà)分布圖代碼示例:

# 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ù)據(jù)可視化圖實(shí)現(xiàn)過(guò)程分析

python畫(huà)分布圖的思路:

先在列表中定義分布圖x、y軸的數(shù)值,然后使用plt.plot()方法即可將分布圖繪制出來(lái)。

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享Python數(shù)據(jù)可視化圖實(shí)現(xiàn)過(guò)程分析內(nèi)容對(duì)大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,遇到問(wèn)題就找億速云,詳細(xì)的解決方法等著你來(lái)學(xué)習(xí)!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI