       if vars[axis].scale.value is "log"
 
         zero = if allPositive then 1 else -1
+        domain = domain.slice().reverse() if allPositive and axis is "y"
 
         lowerScale = Math.pow(10, parseInt(Math.abs(domain[0])).toString().length - 1) * zero
         lowerMod = domain[0] % lowerScale
-        lowerDiff = if allNegative then lowerScale - lowerMod else lowerMod
+        lowerDiff = lowerMod
+        if lowerMod and lowerDiff/lowerScale <= 0.2
+          lowerDiff += lowerScale * zero
         lowerValue = if lowerMod is 0 then lowerScale else lowerDiff
         domain[0] -= lowerValue * zero
         domain[0] = zero if domain[0] is 0


        upperScale = Math.pow(10, parseInt(Math.abs(domain[1])).toString().length - 1) * zero
        upperMod = domain[1] % upperScale
        upperDiff = if allPositive then upperScale - upperMod else upperMod
        upperValue = if upperMod is 0 then upperScale else upperDiff
        domain[1] += upperValue * zero
        domain[1] = zero if domain[1] is 0

      else
        zero = 0

        additional = Math.abs(domain[1] - domain[0]) * 0.05 or 1


        domain[1] = zero if (allPositive and domain[1] < zero) or
                            (allNegative and domain[1] > zero)

        domain = domain.reverse() if axis is "y"

      vars[axis].scale.viz.domain(domain)

