get ylim in plot_ly (plotly) in R

I found the solution:

Notice how we’ve hard coded the extent of these lines in data coordinates; so when zooming and panning the plot, the line will be “clipped” at those values. If you don’t want these lines to be clipped, use a line shape with xref/yref set to paper (this puts the graph region on a 0-1 scale, rather than on the x/y data scale)

source: Horizontal/Vertical Line in plotly

This way I don’t need to find the maximum, I can simply draw the line and it will be fitted to the plot limits automatically.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top