Spaces:
Build error
Build error
feat: Add legend for topics in vis
Browse files
app.py
CHANGED
@@ -59,13 +59,15 @@ def draw_interactive_scatter_plot(
|
|
59 |
Palette = AuxPallete
|
60 |
p = figure(plot_width=800, plot_height=800, tools=[hover], title='2D visualization of tweets', background_fill_color="#fafafa")
|
61 |
colors = factor_cmap("label", palette=[Pallete[n_colors][int(id_) + 1] for id_ in values_set], factors=values_set)
|
62 |
-
p.circle("x", "y", size=12, source=source, fill_alpha=0.4, line_color=colors, fill_color=colors)
|
63 |
p.axis.visible = False
|
64 |
p.xgrid.grid_line_dash = "dashed"
|
65 |
p.ygrid.grid_line_dash = "dashed"
|
66 |
# p.xgrid.grid_line_color = None
|
67 |
# p.ygrid.grid_line_color = None
|
68 |
p.toolbar.logo = None
|
|
|
|
|
69 |
|
70 |
disclaimer = Label(x=0, y=0, x_units="screen", y_units="screen",
|
71 |
text_font_size="14px", text_color="gray",
|
|
|
59 |
Palette = AuxPallete
|
60 |
p = figure(plot_width=800, plot_height=800, tools=[hover], title='2D visualization of tweets', background_fill_color="#fafafa")
|
61 |
colors = factor_cmap("label", palette=[Pallete[n_colors][int(id_) + 1] for id_ in values_set], factors=values_set)
|
62 |
+
p.circle("x", "y", size=12, source=source, fill_alpha=0.4, line_color=colors, fill_color=colors, legend_group="label")
|
63 |
p.axis.visible = False
|
64 |
p.xgrid.grid_line_dash = "dashed"
|
65 |
p.ygrid.grid_line_dash = "dashed"
|
66 |
# p.xgrid.grid_line_color = None
|
67 |
# p.ygrid.grid_line_color = None
|
68 |
p.toolbar.logo = None
|
69 |
+
p.legend.location = "top_left"
|
70 |
+
p.legend.title = "Topics ID"
|
71 |
|
72 |
disclaimer = Label(x=0, y=0, x_units="screen", y_units="screen",
|
73 |
text_font_size="14px", text_color="gray",
|