Rangebreaks by bounds using both date and time / doesn't show hover labels

I’m pretty new to Plotly and Python in general but is there a way to get the graph to remove gaps in a candlestick charts using bounds from a specific day and time to another? (Eg. Fri 21:00 to Sun 21:00) When I use rangebreaks bounded from sat to mon, it removes Fri 21:00 to Mon 0:00 (removing 3 hrs too much).

Also, when I rangebreak from Sat to Mon:

rangebreaks = dict(bounds=["sat", "mon"])

hover labels don’t show up for some reason but when I bound from [‘sat’, ‘sun’], the gaps are bigger but hover labels still appear.

[‘sat’, ‘mon’] (Hovering over data and nothing shows)

[‘sat’, ‘sun’] (Hover works but gaps are larger)

Also realized that when there are hover labels, candlestick width change w/ x axis when zoomed and they have a darker border around each candlestick:

vs. when there’s no hover (candlesticks have static width):


[code]import pandas as pd
import plotly as py
import plotly.graph_objs as go

df = pd.read_csv('Data/USDCAD15.csv', index_col=0, parse_dates=True, dayfirst=True) # import csv and automatically set Date as index
df.index.name = 'Date' # Set index name to Date
df.index = pd.to_datetime(df.index) # Convert datetime
df = df.drop_duplicates(keep=False) # Drop weekends

df_trunc = df.truncate(after=pd.Timestamp('2019-05-01'))

layout = go.Layout(
        dict(bounds=["sat", "mon"]), # hide weekends
        dict(values=["2015-12-25", "2016-01-01"]) # hide Christmas and New Year's

trace = go.Candlestick(x=df_trunc.index, open=df_trunc.Open, high=df_trunc.High, low=df_trunc.Low, close=df_trunc.Close,
                       name='Currency Quote')

data = [trace]

fig = go.Figure(data=data, layout=layout)

py.offline.plot(fig, filename='USDCAD.html')
1 Like

I am encountering same problem.

Same here, couldn’t find a workaround so far :frowning:

We’ve got a couple of known bugs with candlestick charts which should be resolved in a few days and part of the next version of Plotly.py!

Sorry to bother here. But does rangebreaks work with Plotly R as well ??

The upcoming version 4.8.2 of plotly.py should resolve many of these problems… Should be out in a few days :slight_smile:

1 Like