1

我正在使用袖扣在 jupyter notebook 中绘制烛台图。如何消除图表中非交易日的缺口。在 plotly 中,我们可以将布局 ['xaxis']['type'] 更新为 'category'。我们如何为袖扣中的 QuantFig 更新相同的内容。以下是我的代码。

import cufflinks as cf
import pandas as pd
import plotly
from plotly import tools
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
print("List of Cufflinks Themes : ", cf.getThemes())

cf.set_config_file(theme='pearl',sharing='public',offline=True)
daily = pd.read_csv('data.csv',index_col=0,parse_dates=True)

qf=cf.QuantFig(daily,title='my test chart',legend='left',name='Test')
qf.add_volume()

qf.iplot()
4

1 回答 1

0

这对我有用:

fig = qf.iplot(kind='candle')
fig.update_xaxes(
    rangebreaks=[
        dict(bounds=["sat", "mon"]), #hide weekends
    ]
)

(此处描述:https ://plotly.com/python/time-series/#hiding-weekends-and-holidays )

于 2022-02-10T21:51:57.567 回答