Set x-range to default value

Hello,

I am plotting data across a large date range. I would like to display a small range when the figure is first displayed so that the viewer is not overwhelmed. I have attempted to implement this with the following code:

DEFAULT_RANGE = ['2018-03-01', '2018-03-03']

figure_dict[measurement] = go.Scattergl(
    x=cycle['t_stamp'],
    y=cycle[f'H74_1_Extruder_{i}_{measurement}'],
    mode='markers',
    name=f'Extruder {i} {measurement}',
    marker=dict(
        color=EXTRUDER_MEASURMENT_COLOURS[j],
        size=2
    ),
    xaxis=dict(
        range=DEFAULT_RANGE
    )
)

The pertinent lines are:

xaxis=dict(
   range=DEFAULT_RANGE
)

This was motivated after looking through the documentation (https://plot.ly/python/reference/#layout-xaxis-range). Unfortunately, it does not change the initial x-axis as desired. Is there something I am doing wrong?

Thank you very much,

Will

xaxis.range is a layout attribute and you’re currently setting it in a trace object.

Thank you for your help, @etienne!