Now the part where it fails
If I make the same with a “rect” shape, instead of a line, the plotted chart shows fine, but if you do a double-click (reset zoom event) over it, the chart does not obey the yaxis.range… Maybe it’s a bug??? Does someone knows how to fix this??
First, it creates the chart with the yaxis.range configured, then creates the shape on it (the shape is taller than the data on the chart)
If you do a double click, the graph rescales to show the full height of the shape, omitting the yaxis.range values. If you inspect the chart object, the _fullLayout.shapes properties are fine, and also the yaxis.range is in place.
https://codepen.io/etpinard/pen/ejRNjq?editors=1010 where the first layout is properly set and saved for axis reset on double clicks. Note that 'yaxis.range' is not valid syntax in the layout object passed to Plotly.plot
Sorry to bother you with this, but in your examples, it happens the same, if you make a double-click over the charts, the plot somehow resets the yaxis.range to show the full shape. Try, in your examples, to do a double-click several times (twice should be enough) and you will see what I’m telling you.