我有一个使用matplotlib完成的价格图表,希望其他信息显示在每根蜡烛上方或下方的图表上。
类似于此示例,方框/矩形的颜色应根据给定的值(例如热图)而改变。 (tensorchars.com)
这怎么办?仅使用matplotlib还是有可能需要它,还是需要一些其他东西?
感谢每一次输入!
致谢
编辑:
这是我的生成烛图的代码
import requests
import pandas as pd
from datetime import datetime
from mpl_finance import candlestick2_ohlc
import matplotlib.pyplot as plt
start = datetime.strptime('01.07.2018 09:00:00','%d.%m.%Y %H:%M:%S')
start_timestamp = start.timestamp() * 1000 #transform to ms
end = datetime.strptime('04.07.2018 00:00:00','%d.%m.%Y %H:%M:%S')
end_timestamp = end.timestamp() * 1000 #transform to ms
url_kurse = "https://api.bitfinex.com/v2/candles/trade:15m:tBTCUSD/hist"
params = { 'start': start_timestamp, 'end': end_timestamp}
r = requests.get(url_kurse, params = params)
tckr = r.json()
tckr = pd.DataFrame(tckr, columns=["date","open","close","high", "low", "volume"])
tckr = tckr.iloc[::-1]
tckr.set_index("date",inplace=True)
tckr.index = pd.to_datetime(tckr.index, unit = "ms")
fig = plt.figure(figsize=(12,8))
ax = plt.subplot2grid((8,1),(0,0), rowspan = 8, colspan = 1)
candlestick2_ohlc(ax, tckr['open'], tckr['high'], tckr['low'], tckr['close'], width=0.8, colorup="g",colordown="black", alpha=1)
plt.show()