Looking at the first example here, there are two actions I can perform when clicking and dragging on the x-axis. Notice how in the picture below, the mouse pointer is in the middle of the x axis.
If I start dragging now, I can move the x-axis left and right, resulting in something like this (note that the x-axis range moved from about [1,2] to about [1.4,2.4]):
However, if I start the dragging process with the mouse pointer at the very beginning or end of the x-axis, I can stretch or shrink the x-axis range (note how the x-axis range grew from [1,2] to about [1,3]):
I am aware that I can call “fig.update_xaxes(fixedrange=True)” to prevent both of these behaviours. However, I only want to disable stretching/shrinking and keep the moving to left and right enabled. In other terms, I want the user to be able to change the x-axis range only while containing a fixed range size.
Is there any way to do this?