|
|
|
@ -143,21 +143,12 @@ def compute_logarithmic_scale(min_, max_, min_scale, max_scale):
|
|
|
|
|
|
|
|
|
|
def compute_scale( |
|
|
|
|
min_, max_, logarithmic=False, order_min=None, |
|
|
|
|
min_scale=4, max_scale=20, force_steps=None): |
|
|
|
|
min_scale=4, max_scale=20): |
|
|
|
|
"""Compute an optimal scale between min and max""" |
|
|
|
|
if min_ == 0 and max_ == 0: |
|
|
|
|
return [0] |
|
|
|
|
if max_ - min_ == 0: |
|
|
|
|
return [min_] |
|
|
|
|
if force_steps: |
|
|
|
|
# TODO: handle logarithmic scale |
|
|
|
|
step = float(max_ - min_) / (force_steps - 1) |
|
|
|
|
curr = min_ |
|
|
|
|
ret = [] |
|
|
|
|
for i in range(force_steps): |
|
|
|
|
ret.append(curr) |
|
|
|
|
curr += step |
|
|
|
|
return ret |
|
|
|
|
if logarithmic: |
|
|
|
|
log_scale = compute_logarithmic_scale( |
|
|
|
|
min_, max_, min_scale, max_scale) |
|
|
|
|