def test_get_radius_unequal_data_ratio(self): """ Test that when getting the radius, the correct radii are used even if the data ratio is not equal. """ viz = drawable.Drawable(plt.figure(figsize=(10, 10))) graph = Graph(viz) point = viz.scatter(0, 0, s=1000) viz.set_xlim((-2, 2)) viz.set_ylim((-1, 1)) bb = util.get_bb(viz.figure, viz.axes, point) self.assertEqual(round(bb.width / 2, 10), round(graph._get_radius(point, s=1000)[0], 10)) self.assertEqual(round(bb.height / 2, 10), round(graph._get_radius(point, s=1000)[1], 10)) viz.set_xlim((-1, 1)) viz.set_ylim((-2, 2)) bb = util.get_bb(viz.figure, viz.axes, point) self.assertEqual(round(bb.width / 2, 10), round(graph._get_radius(point, s=1000)[0], 10)) self.assertEqual(round(bb.height / 2, 10), round(graph._get_radius(point, s=1000)[1], 10))
def test_get_radius_same_aspect_ratio(self): """ Test that when getting the radius, the correct radii are returned. """ viz = drawable.Drawable(plt.figure(figsize=(10, 10))) graph = Graph(viz) point = viz.scatter(0, 0, s=1000) bb = util.get_bb(viz.figure, viz.axes, point) self.assertEqual(round(bb.width / 2, 10), round(graph._get_radius(point, s=1000)[0], 10)) self.assertEqual(round(bb.height / 2, 10), round(graph._get_radius(point, s=1000)[1], 10))