cakiki commited on
Commit
e96be06
1 Parent(s): 73c64da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -22,11 +22,30 @@ data_for_umap = RobustScaler().fit_transform(penguins.select_dtypes(include="num
22
 
23
  penguin_datamap = umap.UMAP(random_state=42).fit_transform(data_for_umap)
24
 
25
- basic_plot = tnt.BokehPlotPane(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  penguin_datamap,
27
  labels=penguins.species,
28
  hover_text=penguins.select_dtypes(include="object").apply(" ".join, axis=1),
29
- width=700,
 
 
 
30
  )
 
 
31
 
32
- pn.Row(basic_plot).servable()
 
22
 
23
  penguin_datamap = umap.UMAP(random_state=42).fit_transform(data_for_umap)
24
 
25
+
26
+ label_layers = tnt.MetadataLabelLayers(
27
+ data_for_umap,
28
+ penguin_datamap,
29
+ penguins,
30
+ hdbscan_min_cluster_size=5,
31
+ hdbscan_min_samples=5,
32
+ contamination=1e-6,
33
+ min_clusters_in_layer=3,
34
+ vector_metric="euclidean",
35
+ cluster_distance_threshold=0.0,
36
+ random_state=0,
37
+ )
38
+
39
+ annotated_plot = tnt.BokehPlotPane(
40
  penguin_datamap,
41
  labels=penguins.species,
42
  hover_text=penguins.select_dtypes(include="object").apply(" ".join, axis=1),
43
+ legend_location="top_right",
44
+ width=800,
45
+ height=800,
46
+ align="center"
47
  )
48
+ annotated_plot.add_cluster_labels(label_layers, text_size_scale=64, text_layer_scale_factor=3.0)
49
+
50
 
51
+ pn.Row(annotated_plot).servable()