code: def _digits(minval, maxval):
      
      if minval == maxval:
          return 3
      else:
          return min(10, max(2, int(1 + abs(np.log10(maxval - minval)))))
docs: Digits needed to comforatbly display values in [minval, maxval]