1

I am using cufflinks for plotting candlestick charts in jupyter notebook. How to remove gaps of non trading days in chart. In plotly we can update layout ['xaxis']['type'] to 'category'. How can we update the same for a QuantFig in cufflinks. Follwowing is my code.

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()

2 Answers2

0

This did the trick for me:

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

(described here: https://plotly.com/python/time-series/#hiding-weekends-and-holidays)

Sigi R.
  • 1
  • 1
0

You may try this

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

fig = qf.figure()
fig.update_xaxes(
    rangebreaks=[dict(bounds=["sat", "mon"])])
fig.show()
William
  • 1
  • 1
  • While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Adrian Mole Sep 07 '22 at 08:11