Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

How does plotly calculate the max tick value?

We are having issues calculating the tick values along the yaxis. Currently we are calculating the max value in our data array using the Math.max() and setting conditions based on the result, however due to the large differences in the data that we receive, this has become a very cumbersome task. I was wondering how plotly calculates when to add the next tick so that i could replicate it for our purposes. As you can see in the codepen here plotly adds an extra tick when the max value hits 24 but in the second example it only adds one when the max value is 114 but not 113. I would expect the first change but in the second case i would expect it to change at 109 or 110. We set our dtick value based on the result of the conditions we have in place but as i said this is not ideal or accurate.
Would appreciate any help with this.

Thank in advance.

1 Like

I have noticed this behaviour too in my PlotlyJS charts inside an application I am currently developing.

My end users always want to see the last label on the y-axis. (So using your Codepen as an example; in the second chart I would want to see 120 as the last y-axis tick, for example, as it makes it easier to gauge the maximum value for a given trace)

If you make any progress on this issue could you please share it here or via PM?

Thank you.