def test_draw_scatterplot(self): """draw_scatterplot: draws the matplotlib scatterplot""" exp = array([[-0.04, 0.2]]) sc_plot = draw_scatterplot(self.props, self.xy_coords, self.x_len, self.y_len, self.size, self.background_color, self.label_color, None, self.alpha) obs = sc_plot.get_offsets() assert_almost_equal(obs, exp)
def test_transform_xy_coords(self): """transform_xy_coords: transforms the xy coords from the matplotlib \ plot into html spatial coords which allows for mouseovers""" sc_plot = draw_scatterplot(self.props, self.xy_coords, self.x_len, self.y_len, self.size, self.background_color, self.label_color, None, self.alpha) obs1, obs2, obs3 = transform_xy_coords(self.xy_coords, sc_plot) self.assertEqual(len(obs1), len(self.all_cids)) self.assertEqual(len(obs2), len(self.all_xcoords)) self.assertEqual(len(obs3), len(self.all_ycoords))