Disable auto scaling of axis in plotly python animation

Hello all,

I am trying to use animation on jupyter notebook using python and plotly animation. I am stuck with two issues. While animation is running and data is changing for each frame, the x-axis is also changing with it. What i want is to just animate the data and keep the axis unchangeable.
Here is the images which shows animation on creation of plot (i.e loading data at first time) and changing x-axis.

PS. I have used autorange : False too, which is not helping and still getting the same result.

The other issue is, after completion of animation when I click the play button, x-axis does not change but its value is the same as it was in last frame and also animation stops at x-axis.
Here is the image, which shows animation after clicking Play button.


Please someone help me out? I am new to plotly.

Thanks,
Hemang

I have the same annoying problem.
Anyone has a solution?

Hi @robrados,
To prevent xaxis (and/or yaxis) changing from frame to frame set its range
xaxis_range =[lower_value, upper_value]
This setting makes:
xaxis_autorange=False.

See:
help(go.layout.XAxis.autorange):

Help on property:

    Determines whether or not the range of this axis is computed in
    relation to the input data. See `rangemode` for more info. If
    `range` is provided, then `autorange` is set to False.
    
    The 'autorange' property is an enumeration that may be specified as:
      - One of the following enumeration values:
            [True, False, 'reversed']
    
    Returns
    -------
    Any
2 Likes