How does matplotlib automatically set its y-axis values?

Hi! Sorry if this is a rooke question. I have looked in the docs but dont seem to find an answer.

I’m wondering how matplotlib automatically sets its y-axis values. When I plot a graph using matplotlib, I get perfectly evenly spaced y-axis values with some distance above/below the min/max values.

My objective is to use Python in order to replicate these values (y-axis) without having to plot the graph. I’ve tried this on my own but the problem that arise is that I use different datasets and I’m not able to automate the process. Some datasets ranges from 1.202 to 1.211 with some decimals while other datasets range from 1000 to 3000. Is there a reference that I could use that replicates the method Matplotlib uses?

It’s just the max and min of the data with a user settable margin.

Thanks. When I specify the number of bins, what determines the step and the starting point?

Not sure what bins you are referring to.