def test_log_scale_subdecade(self): # Test cases where log_interval is less than 1. scale = LogScale() ticks = scale.ticks(1.0, 2.0) self.check_ticks(ticks, array((1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0))) ticks = scale.ticks(0.9,2.1) self.check_ticks(ticks, array((1.0, 1.25, 1.5, 1.75, 2.0))) ticks = scale.ticks(1.1,9.9) self.check_ticks(ticks, array((2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0)))
def test_log_scale_interval1(self): # Test the case where 1 < log_interval < desired_ticks, and interval=1 # is the case that generates the ticks. scale = LogScale() ticks = scale.ticks(1.0,10.1) self.check_ticks(ticks, array((1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0))) ticks = scale.ticks(9.3,99.9) self.check_ticks(ticks, array((10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0))) ticks = scale.ticks(9.9,100.0) self.check_ticks(ticks, array((10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0)))
def test_log_scale(self): scale = LogScale() ticks = scale.ticks(0.1, 10.0) self.check_ticks(ticks, array((0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 2.0, 4.0, 6.0, 8.0, 10.0))) ticks = scale.ticks(10.0, 1000.0) self.check_ticks(ticks, array((10.0, 20.0, 40.0, 60.0, 80.0, 100.0, 200.0, 400.0, 600.0, 800.0, 1000.0))) ticks = scale.ticks(9.9, 1000.0) self.check_ticks(ticks, array((10.0, 20.0, 40.0, 60.0, 80.0, 100.0, 200.0, 400.0, 600.0, 800.0, 1000.0))) ticks = scale.ticks(5.0, 4300) self.check_ticks(ticks, array((5, 10, 50, 100, 500, 1000))) # Test case when the log_interval is greater than 8 (the # default desired_ticks) ticks = scale.ticks(1e-3,1e6) self.check_ticks(ticks, array((1e-3, 1e-2, 1e-1, 1, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6)))