我的数据由Date i组成,然后由“ Open”,“ High”,“ Low”,“ Close”列组成。
data = pd.read_csv('5MEURUSD.csv', header = None)
data.columns = ['Date', 'Time', 'Open', 'High', 'Low', 'Close', 'Volume']
data['Date'] = data['Date'] + ' ' + data['Time']
data['Date'] = pd.to_datetime(data['Date'])
data = data.set_index('Date')
CPI_AUG19 = data['2019-08-13':'2019-08-13']
CPI_JUL19 = data['2019-07-11':'2019-07-12']
CPI_JUN19 = data['2019-06-12':'2019-06-13']
CPI_MAY19 = data['2019-05-10':'2019-05-11']
CPI_APR19 = data['2019-04-11':'2019-04-12']
CPI_MAR19 = data['2019-03-12':'2019-03-13']
CPI_FEB19 = data['2019-02-13':'2019-02-14']
CPI_JAN19 = data['2019-01-11':'2019-01-12']
CPI_DEC18 = data['2018-12-12':'2018-12-13']
CPI_NOV18 = data['2018-11-14':'2018-11-15']
CPI_OCT18 = data['2018-10-11':'2018-10-12']
CPI_SEP18 = data['2018-09-13':'2018-09-14']
CPI_AUG18 = data['2018-08-10':'2018-08-11']
我设法用此代码获得一张图:
import plotly
import plotly.plotly as py
from plotly import tools
from plotly.graph_objs import *
trace_CPI_AUG19 = Candlestick(x=CPI_AUG19.index,
open=CPI_AUG19['Open'],
high=CPI_AUG19['High'],
low=CPI_AUG19['Low'],
close=CPI_AUG19['Close']) layout = Layout(
xaxis = dict(
rangeslider = dict(
visible = False
)
) )
CPI_AUG19 = [trace_CPI_AUG19]
fig = Figure(data = CPI_AUG19, layout = layout)
py.iplot(fig, filename = 'simple_candlestick_without_range_slider')
我尝试了多种使用Plotly制作子图的方法,但是它们都不起作用,所以我正在寻找一种新方法。
我想要的输出是12个子图,一个并排,分布在2行和6列中。
谢谢您的输入。