欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

對(duì)Python中plt的畫圖函數(shù)詳解

 更新時(shí)間:2018年11月07日 14:42:10   作者:zsc201825  
今天小編就為大家分享一篇對(duì)Python中plt的畫圖函數(shù)詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

1、plt.legend

plt.legend(loc=0)#顯示圖例的位置,自適應(yīng)方式
說(shuō)明:

'best'   : 0, (only implemented for axes legends)(自適應(yīng)方式)
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4,
'right'  : 5,
'center left' : 6,
'center right' : 7,
'lower center' : 8,
'upper center' : 9,
'center'  : 10,

2、plt.figure

plt.figure(figsize=(14, 6), dpi=80)#設(shè)置繪圖區(qū)域的大小和像素

3、plt.xticks

plt.xticks(new_year)#設(shè)置x軸的刻度線為new_year,new_year可以為數(shù)組

4、plt.xlabel

plt.xlabel('year')#x軸標(biāo)簽

5、plt.plot

plt.plot(number, color='blue', label="actual value")#將實(shí)際值的折線設(shè)置為藍(lán)色

6、兩個(gè)圖分開(kāi)

fig, axes = plt.subplots(2, 1, sharex=True,figsize=(10,10))
axes[0].plot(range (len(data20)),data20,'r')
axes[1].plot(range (len(data40)),data40,'b') 

7、畫豎直線

plt.axvline(99, linestyle="dotted", linewidth=4, color='r')#99表示橫坐標(biāo)

8、圖片保存

plt.savefig('timeseries_y.jpg')

以上這篇對(duì)Python中plt的畫圖函數(shù)詳解就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論