def update_part_scatter(x_col_name, y_col_name, color_name, hover_props): """ Upon scatter plot properties, update the plotly figure. """ if not x_col_name or not y_col_name: return go.Figure() return plotly_scatter(x_col_name, y_col_name, hover=hover_props, data=df, hue=color_name, marker_size=plot_style.get("marker_size", 12), marker_alpha=plot_style.get("marker_alpha", 0.3), target="fig")
def test_x_y_symbol_col_on_hover(self): fig = plotly_scatter("b", "c", data=self.data, symbol="a", hover="a") self.assert_valid_plotly_figure(fig, num_renderers=NUM_A_VALUES)
def test_x_y_symbol_pick_hue(self): fig = plotly_scatter("b", "c", data=self.data, symbol="a", hue="rgb(255, 0, 0)") self.assert_valid_plotly_figure(fig, num_renderers=NUM_A_VALUES)
def test_x_y_symbol_int_col(self): fig = plotly_scatter("b", "c", data=self.data, symbol="c") self.assert_valid_plotly_figure(fig, num_renderers=6)
def test_x_y_hover(self): fig = plotly_scatter("b", "c", data=self.data, hover="a") self.assert_valid_plotly_figure(fig)
def test_x_y_2_prop_hue(self): self.skipTest("Not supported yet") fig = plotly_scatter("b", "c", data=self.data, hue=["a", "index"]) self.assert_valid_plotly_figure(fig)
def test_x_y_hue_and_hue_map(self): color_map = {"a": BLACK, "b": BLUE, "c": RED, "d": GREEN} fig = plotly_scatter("b", "c", data=self.data, hue="a", palette=color_map) self.assert_valid_plotly_figure(fig, num_renderers=NUM_A_VALUES)
def test_create_x_y_z_hue_hover(self): fig = plotly_scatter(x="b", y="c", z="d", data=self.data, hue="a", hover="index") self.assert_valid_plotly_figure(fig, num_renderers=NUM_A_VALUES)
def test_x_y_pick_color_and_symbol(self): fig = plotly_scatter("b", "c", data=self.data, symbol="square", hue="rgb(255, 0, 0)") self.assert_valid_plotly_figure(fig)
def test_x_y_pick_symbol(self): fig = plotly_scatter("b", "c", data=self.data, symbol="square") self.assert_valid_plotly_figure(fig)
def test_x_y_pick_color(self): fig = plotly_scatter("b", "c", data=self.data, hue="rgb(255, 0, 0)") self.assert_valid_plotly_figure(fig)
def test_x_y(self): fig = plotly_scatter("b", "c", data=self.data) self.assert_valid_plotly_figure(fig)
def test_missing_data(self): with self.assertRaises(ValueError): plotly_scatter("b", "c")
def test_create_x_y_z_hue_hover_symbol_on_bool_col(self): self.skipTest("Not supported yet") fig = plotly_scatter(x="b", y="c", z="d", data=self.data, hue="a", hover="index", symbol="e") self.assert_valid_plotly_figure(fig)
def test_x_y_symbol_hue_hover(self): fig = plotly_scatter("b", "c", data=self.data, symbol="a", hue="index", hover="index") num_a_index_pairs = 6 self.assert_valid_plotly_figure(fig, num_renderers=num_a_index_pairs)
def test_x_y_hue(self): fig = plotly_scatter("b", "c", data=self.data, hue="a") self.assert_valid_plotly_figure(fig, num_renderers=NUM_A_VALUES)
def test_create_x_y_z(self): fig = plotly_scatter(x="b", y="c", z="d", data=self.data) self.assert_valid_plotly_figure(fig)