def test_calc_data_point_locations_custom_spacing(self): """Should return non-evenly-spaced x-axis locations.""" # Scaling down from 3..12 to 1..4. locs = _calc_data_point_locations(4, [3, 4, 10, 12]) self.assertFloatEqual(locs, array([1, 1.33333333, 3.33333333, 4])) # Sorted order shouldn't affect scaling. locs = _calc_data_point_locations(4, [4, 3, 12, 10]) self.assertFloatEqual(locs, array([1.33333333, 1, 4, 3.33333333])) # Scaling up from 0.001..0.87 to 1..3. locs = _calc_data_point_locations(3, [0.001, 0.2543, 0.87]) self.assertFloatEqual(locs, array([1, 1.58296893, 3]))
def test_calc_data_point_locations_custom_spacing(self): """Should return non-evenly-spaced x-axis locations.""" # Scaling down from 3..12 to 1..4. locs = _calc_data_point_locations(4, [3, 4, 10, 12]) self.assertFloatEqual(locs, array([1, 1.33333333, 3.33333333, 4])) # Sorted order shouldn't affect scaling. locs = _calc_data_point_locations(4, [4, 3, 12, 10]) self.assertFloatEqual(locs, array([1.33333333, 1, 4, 3.33333333])) # Scaling up from 0.001..0.87 to 1..3. locs = _calc_data_point_locations(3, [0.001, 0.2543, 0.87]) self.assertFloatEqual(locs, array([1, 1.58296893, 3]))
def test_calc_data_point_locations_default_spacing(self): """Should return evenly-spaced x-axis locations.""" locs = _calc_data_point_locations(4) self.assertEqual(locs, array([1, 2, 3, 4]))
def test_calc_data_point_locations_default_spacing(self): """Should return evenly-spaced x-axis locations.""" locs = _calc_data_point_locations(4) self.assertEqual(locs, array([1, 2, 3, 4]))
def test_calc_data_point_locations_custom_spacing(self): """_calc_data_point_locations() should return an array containing the x-axis locations for each data point, spaced according to a custom spacing scheme.""" locs = _calc_data_point_locations([3, 4, 10, 12], 4, 2, 0.25, 0.75) self.assertEqual(locs, array([3.75, 5.0, 12.5, 15.0]))
def test_calc_data_point_locations_default_spacing(self): """_calc_data_point_locations() should return an array containing the x-axis locations for each data point, evenly spaced from 1..n.""" locs = _calc_data_point_locations(None, 4, 2, 0.25, 0.5) self.assertEqual(locs, array([1.0, 2.0, 3.0, 4.0]))