Black Lives Matter. Please consider donating to Black Girls Code today.

Mixed Timestamp Formatting for x-axis

Hi everyone, I’m building a timeseries visualization that uses an x-axis rangeslider. The layout is almost identical to this example from the documentation:

df = pd.read_csv('')

fig = go.Figure(go.Scatter(
    x = df['Date'],
    y = df['mavg']

    tickformatstops = [
        dict(dtickrange=[None, 1000], value="%H:%M:%S.%L ms"),
        dict(dtickrange=[1000, 60000], value="%H:%M:%S s"),
        dict(dtickrange=[60000, 3600000], value="%H:%M m"),
        dict(dtickrange=[3600000, 86400000], value="%H:%M h"),
        dict(dtickrange=[86400000, 604800000], value="%e. %b d"),
        dict(dtickrange=[604800000, "M1"], value="%e. %b w"),
        dict(dtickrange=["M1", "M12"], value="%b '%y M"),
        dict(dtickrange=["M12", None], value="%Y Y")

If a custom tickformatstops isn’t used, the x-axis will switch to truncated timestamps when a smaller unit of time is incremented; for example, in the image below the year is omitted when it is not incremented.

I can’t seem to get that same behaviour working when specifying a set of custom timestamp formats to tickformatstops. Is there a way to replicate the mixed timestamp formatting behaviour, but with custom timestamp formats?

Thanks in advance for your help!