python怎么用matplotlib画,用matplotlib在python中绘制OHLC图
我有一個燭臺對象的列表,每個對象有6個值(開、高、低、關閉、體積、時間戳)。我想用matplotlib.finance.candlestick2_ohlc(ax,opens,high,lows,closes,width=4,colorup='k',colordown='r',alpha=0.75)函數來繪制此數據。問題是,如何將我的列表細分為開盤、漲停、低開和收盤,以便將其加載到這個函數中?在
這是我的燭臺課:class Candle:
#Candlestick chart object
def __init__(self, open, high, low, close, volume, timeStamp):
self.open = open
self.high = high
self.low = low
self.close = close
self.volume = volume
self.timestamp = timeStamp
def __str__(self):
return """
Open: %s
High: %s
Low: %s
Close: %s
Volume : %s
Timestamp: %s""" %(self.open, self.high, self.low, self.close, self.volume, self.timestamp)
我的施工方法如下:
^{pr2}$
總結
以上是生活随笔為你收集整理的python怎么用matplotlib画,用matplotlib在python中绘制OHLC图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql数据库比较语句,六条比较有用的
- 下一篇: python 下载文件 登录信息-Pyt