Get x and y tick values

Is there anyway to determine (preferably before rendering) what x and y tick values plotly will compute for a given data set? Basically, I’m looking for the equivalent to matplotlib’s xticks or get_xticklabels functions.

Hey @fivecents welcome to the forums!

Interesting question! Unfortunately I’ve never come across a built-in function for that. The answer to your question is burried somewhere on the plotly github in the JS section most likely.

Maybe there is a workaround. Would you mind telling us, why you need these values?

Thanks for the reply and welcome. Getting the tick labels is actually a my own attempted workaround. What I really want to do is fix the size of the axes area (say 400pxx400px) but I can only fix the size of the entire figure. Because of this, the axes area shrinks based on the size of other elements in the plot like the axes title, the tick labels, etc. If I can get the tick labels I can compute their size and pad the overall figure size accordingly to get the axes area size I want. If you know of a better way to achieve this, I’m certainly open to a different approach.

Did you try to fix the figure dimensions and the margins? layout:{margin:...}

The legend could interfere in this calculations too. We had a topic about this a while ago, but I can’t remember exactly.