Time Series Gaps for 1 minutes data, gaps in day and gaps over days

I’m trying to plot futures one minute data over a quarter. I am receiving both gaps in the day since my data only goes from 9:30 to 16:00 and gaps in the weekend/holidays. I’ve read about:

  1. rangebreaks
  2. connectgaps
  3. xaxis as category

I could not get one and two to work, they are commented out in my code.
I could get 3 to work but in reality I could just use an index without datetime.

Here is a sample of my data:

                        open      high       low     close  volume
datetime                                                           
2018-10-01 09:01:00 2940.0000 2940.2500 2939.5000 2939.7500     361
2018-10-01 09:02:00 2939.5000 2940.2500 2939.5000 2940.2500     309
2018-10-01 09:03:00 2940.0000 2940.2500 2940.0000 2940.2500      83
2018-10-01 09:04:00 2940.0000 2940.2500 2940.0000 2940.2500     106
2018-10-01 09:05:00 2940.0000 2940.2500 2940.0000 2940.0000      73

Here is the code I’m using (it will eventually be part of a function…).

# Data
data = dict(
    type="scatter",
    name="ES_q4",
    x=df_orig.index.values,
    y=df["close"].values,
    line=dict(color="blue"),
    #     connectgaps=True,
    #     rangebreaks=[dict(bounds=["sat", "sun"])],
)

# Library for plot formatting.
layout = dict(
    title=dict(
        text="Mind the Gap", font=dict(family="Overpass", size=24, color="firebrick"),
    ),
    showlegend=True,
    legend=dict(
        title=dict(text="Lines", font=dict(family="arial", size=20)),
        borderwidth=2,
        font=dict(family="Balto", size=14),
        orientation="v",
        x=1.1,
        xanchor="left",
        y=1,
        yanchor="top",
        traceorder="reversed",
    ),
    hovermode="x",
    margin=dict(l=120, r=120, t=120, b=120),
    autosize=True,
    width=1200,
    height=800,
    clickmode="none",
    dragmode="zoom",
    selectdirection="h",
    xaxis={"type": "category"},
)

fig = dict(dict(data=data, layout=layout,))
pio.show(fig)

Here is my chart without any adjustement (eg without xaxis={“type”: “category”}, above)

Here is the plot with the xaxis={“type”: “category”} enabled. Note the xaxis is useless for information.

Hoping there’s an easy fix I’m missing. :slight_smile:

Did you have a look here ?

Rangebreaks should be given in axis… In your case it will be xaxis={rangebreaks=[dict(bounds=[“sat”, “mon”])]}

I normally code in R… so please make sure its the correct syntax.

1 Like

Sorry for the delay in getting back. Because Yes that helped a lot. Thanks!

Im glad it worked… This still doesn’t work in R :grimacing: