To start with, there is no _rangeInitial property, instead you have the _rangeInitial0 and _rangeInitial1 properties.
These properties take their values from the range property that we pass in the layout when we first create the graph with any of the newPlot, plot, react, etc. functions; if we don’t pass a range, it starts with the maximum and minimum of the axis value range; these properties are used to reset the axis to the coordinates that it saves every time we use a function that modifies the graph (relayout, restyle, update, redraw, etc.) since these functions re-render all the graphs and elements that you have with the new changes. They are also used when we double-click on the graph, resetting the axes to those coordinates, the same action that the modebar button performs.
If you want the graph to move to certain coordinates when you run some rendering function then you just need to pass the range values when you create the graph
Plotly.newPlot(layer, data, {
xaxis: {
range: [xcoord0, xcoord1]
},
yaxis: {
range: [ycoord0, ycoord1]
},
...
}, config)
If you don’t pass range values when you create the plot and you want the plot to move to a certain position when you use some rendering function like relayout then you will have to pass the range you want to move to
Plotly.relayout(layer, {
"xaxis.range": [newxcoord0, newxcoord1],
...
})
Be careful how you pass the range to the render function as the option above is not the same as the following one.
Plotly.relayout(layer, {
xaxis: {
range": [newxcoord0, newxcoord1]
},
...
})
The first one only changes the range property without modifying the other properties of the xaxis object, the second one will delete all the properties of the xaxis object and set them to the default values and only the range property will be set to the value you passed since it understands that you are passing it a new xaxis object.
And finally, I’ll leave you with an example of how to manipulate the range to move around the graph.