最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python金融數(shù)據(jù)可視化匯總

 更新時(shí)間:2017年11月17日 14:33:52   投稿:laozhang  
這篇文章主要介紹了Python金融數(shù)據(jù)可視化(兩列數(shù)據(jù)的提取,分別畫(huà),雙坐標(biāo)軸,雙圖,兩種不同的圖)等內(nèi)容。

通過(guò)本篇內(nèi)容給大家介紹一下Python實(shí)現(xiàn)金融數(shù)據(jù)可視化中兩列數(shù)據(jù)的提取、分別畫(huà)、雙坐標(biāo)軸、雙圖、兩種不同的圖等代碼寫(xiě)法和思路總結(jié)。

import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt

np.random.seed(2000)
y = np.random.standard_normal((20,2))
# print(y)

'''
不同的求和
print(y.cumsum())
print(y.sum(axis=0))
print(y.cumsum(axis=0))
'''

# 繪圖
plt.figure(figsize=(7,4))
plt.plot(y.cumsum(axis=0),linewidth=2.5)
plt.plot(y.cumsum(axis=0),'bo')

plt.grid(True)
plt.axis("tight")

plt.xlabel('index')
plt.ylabel('values')
plt.title('a simple plot')

plt.show()

2.下面分別提取兩組數(shù)據(jù),進(jìn)行繪圖。

import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt

np.random.seed(2000)
date = np.random.standard_normal((20,2))
y = date.cumsum(axis=0)

print(y)

# 重點(diǎn)下面兩種情況的區(qū)別
print(y[1])   # 取得是 第1行的數(shù)據(jù) [-0.37003581 1.74900181]
print(y[:,0])  # 取得是 第1列的數(shù)據(jù) [ 1.73673761 -0.37003581 0.21302575 0.35026529 ...

# 繪圖
plt.plot(y[:,0],lw=2.5,label="1st",color='blue')
plt.plot(y[:,1],lw=2.5,label="2st",color='red')
plt.plot(y,'ro')

# 添加細(xì)節(jié)
plt.title("A Simple Plot",size=20,color='red')
plt.xlabel('Index',size=20)
plt.ylabel('Values',size=20)

# plt.axis('tight')
plt.xlim(-1,21)
plt.ylim(np.min(y)-1,np.max(y)+1)

# 添加圖例
plt.legend(loc=0)

plt.show()

3.雙坐標(biāo)軸。

import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt

np.random.seed(2000)
date = np.random.standard_normal((20,2))
y = date.cumsum(axis=0)

y[:,0]=y[:,0]*100

fig,ax1 = plt.subplots()
plt.plot(y[:,0],'b',label="1st")
plt.plot(y[:,0],'ro')

plt.grid(True)
plt.axis('tight')
plt.xlabel("Index")
plt.ylabel('Values of 1st')
plt.title("This is double axis label")

plt.legend(loc=0)

ax2=ax1.twinx()
plt.plot(y[:,1],'g',label="2st")
plt.plot(y[:,1],'r*')
plt.ylabel("Values of 2st")
plt.legend(loc=0)

plt.show()

4. 分為兩個(gè)圖繪畫(huà)。

import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt

np.random.seed(2000)
date = np.random.standard_normal((20,2))
y = date.cumsum(axis=0)

y[:,0]=y[:,0]*100

plt.figure(figsize=(7,5))    # 確定圖片大小
plt.subplot(211)        # 確定第一個(gè)圖的位置 (行,列,第幾個(gè))兩行一列第一個(gè)圖

plt.plot(y[:,0],'b',label="1st")
plt.plot(y[:,0],'ro')

plt.grid(True)
plt.axis('tight')
plt.xlabel("Index")
plt.ylabel('Values of 1st')
plt.title("This is double axis label")

plt.legend(loc=0)

plt.subplot(212)        # 確定第一個(gè)圖的位置
plt.plot(y[:,1],'g',label="2st")
plt.plot(y[:,1],'r*')
plt.ylabel("Values of 2st")
plt.legend(loc=0)

plt.show()

5.在兩個(gè)圖層中繪制兩種不同的圖(直線圖立方圖)

import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt

np.random.seed(2000)
date = np.random.standard_normal((20,2))
y = date.cumsum(axis=0)

y[:,0]=y[:,0]*100

plt.figure(figsize=(7,5))    # 確定圖片大小
plt.subplot(121)        # 確定第一個(gè)圖的位置

plt.plot(y[:,0],'b',label="1st")
plt.plot(y[:,0],'ro')

plt.grid(True)
plt.axis('tight')
plt.xlabel("Index")
plt.ylabel('Values',size=20)
plt.title("1st date set")

plt.legend(loc=0)

plt.subplot(122)        # 確定第一個(gè)圖的位置
plt.bar(np.arange(len(y[:,1])),y[:,1],width = 0.5,color='g',label="2nd") # 直方圖的畫(huà)法
plt.grid(True)
plt.xlabel("Index")
plt.title('2nd date set')
plt.legend(loc=0)

plt.show()

以上就是本次交給大家的Python制作金融數(shù)據(jù)等用到的圖形化界面代碼寫(xiě)法。

相關(guān)文章

  • ubuntu上安裝python的實(shí)例方法

    ubuntu上安裝python的實(shí)例方法

    在本篇文章里小編給大家整理的是關(guān)于怎么在ubuntu安裝python的相關(guān)方法,以后需要的朋友們可以學(xué)習(xí)下。
    2019-09-09
  • Python中判斷語(yǔ)句入門(mén)指南(if?elif?else語(yǔ)句)

    Python中判斷語(yǔ)句入門(mén)指南(if?elif?else語(yǔ)句)

    if elif else語(yǔ)句是Python中的控制語(yǔ)句,用于根據(jù)條件執(zhí)行不同的操作,下面這篇文章主要給大家介紹了關(guān)于Python中判斷語(yǔ)句入門(mén)指南(if?elif?else語(yǔ)句)的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2023-05-05
  • 簡(jiǎn)單介紹Python中用于求最小值的min()方法

    簡(jiǎn)單介紹Python中用于求最小值的min()方法

    這篇文章主要介紹了簡(jiǎn)單介紹Python中用于求最小值的min()方法,是Python入門(mén)中的基礎(chǔ)知識(shí),需要的朋友可以參考下
    2015-05-05
  • Python記錄詳細(xì)調(diào)用堆棧日志的方法

    Python記錄詳細(xì)調(diào)用堆棧日志的方法

    這篇文章主要介紹了Python記錄詳細(xì)調(diào)用堆棧日志的方法,涉及Python調(diào)用堆棧日志的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-05-05
  • Python中assert函數(shù)的使用(含源代碼)

    Python中assert函數(shù)的使用(含源代碼)

    本文主要介紹了Python中assert函數(shù)的使用(含源代碼),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2023-04-04
  • Python實(shí)現(xiàn)GIF動(dòng)圖以及視頻卡通化詳解

    Python實(shí)現(xiàn)GIF動(dòng)圖以及視頻卡通化詳解

    本文主要介紹了如何使用Python中的animegan2-pytorch實(shí)現(xiàn)動(dòng)圖以及視頻的卡通化效果,文中的代碼具有一定的學(xué)習(xí)價(jià)值,需要的朋友可以參考一下
    2021-12-12
  • 跟老齊學(xué)Python之for循環(huán)語(yǔ)句

    跟老齊學(xué)Python之for循環(huán)語(yǔ)句

    看這個(gè)標(biāo)題,有點(diǎn)匪夷所思嗎?為什么for是難以想象的呢?因?yàn)樵趐ython中,它的確是很常用而且很強(qiáng)悍,強(qiáng)悍到以至于另外一個(gè)被稱之為迭代的東西,在python中就有點(diǎn)相形見(jiàn)絀了。在別的語(yǔ)言中,for的地位從來(lái)沒(méi)有如同python中這么高的。
    2014-10-10
  • python實(shí)現(xiàn)圖片文件批量重命名

    python實(shí)現(xiàn)圖片文件批量重命名

    這篇文章主要為大家詳細(xì)介紹了python實(shí)現(xiàn)圖片文件批量重命名,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-05-05
  • Python類的動(dòng)態(tài)綁定實(shí)現(xiàn)原理

    Python類的動(dòng)態(tài)綁定實(shí)現(xiàn)原理

    這篇文章主要介紹了Python類的動(dòng)態(tài)綁定實(shí)現(xiàn)原理,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-03-03
  • python PyAUtoGUI庫(kù)實(shí)現(xiàn)自動(dòng)化控制鼠標(biāo)鍵盤(pán)

    python PyAUtoGUI庫(kù)實(shí)現(xiàn)自動(dòng)化控制鼠標(biāo)鍵盤(pán)

    這篇文章主要介紹了python PyAUtoGUI庫(kù)實(shí)現(xiàn)自動(dòng)化控制鼠標(biāo)鍵盤(pán),幫助大家更好的理解和使用python,感興趣的朋友可以了解下
    2020-09-09

最新評(píng)論

本溪市| 定州市| 固镇县| 永年县| 汪清县| 浦城县| 庐江县| 团风县| 洛浦县| 武清区| 辽中县| 齐齐哈尔市| 铁岭县| 友谊县| 周宁县| 武胜县| 深圳市| 龙南县| 鸡西市| 罗平县| 乐安县| 宿州市| 巴彦淖尔市| 沐川县| 深泽县| 禄劝| 淮阳县| 曲周县| 镇远县| 铜梁县| 密山市| 开阳县| 交城县| 信宜市| 青海省| 安多县| 靖安县| 嘉禾县| 榕江县| 邵武市| 松江区|