def generateTickStep(dps):
coeff = [1., 2., 5.]
coeffIdx = 0
mult = 1.
step = coeff[coeffIdx] * mult
#Replaces 0 by NaN to ignore 0 as min
dps_new = dps
dps_new[dps_new == 0] = np.nan
dpsRange = max(dps) - min(dps_new)
while dpsRange / step >= 8:
coeffIdx = (coeffIdx + 1) % 3
if coeffIdx == 0:
mult = mult * 10.
step = coeff[coeffIdx] * mult
return step
评论列表
文章目录