Skip to content

Commit a8a4417

Browse files
committed
add plots
1 parent 7480b48 commit a8a4417

13 files changed

Lines changed: 5 additions & 4 deletions

tmp_plots/clustering.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ def plot_agglomerative_clustering_and_pca(
9494
def _fmt_label(formula, id_):
9595
s = str(formula) if pd.notna(formula) else ""
9696
s = s.strip()
97-
if len(s) > 60:
98-
s = s[:60] + "..."
97+
max_length = 45
98+
if len(s) > max_length:
99+
s = s[:max_length] + "..."
99100
return f"{s} [{id_}]"
100101

101102
labels_list = [_fmt_label(labels_series.loc[i], id_series.loc[i]) for i in clu_df.index]
@@ -144,7 +145,7 @@ def link_color_func(node_id):
144145
# Dendrogram
145146
n_leaves = len(labels_list)
146147
fig_height = max(6, 0.28 * n_leaves + 2)
147-
fig = plt.figure(figsize=(12, fig_height))
148+
fig = plt.figure(figsize=(6, fig_height))
148149
link_color_func = _make_link_color_func(Z, labels, palette_hex)
149150
dobj = dendrogram(
150151
Z,
@@ -171,7 +172,7 @@ def link_color_func(node_id):
171172
# PCA projection
172173
pca = PCA(n_components=2)
173174
coords = pca.fit_transform(X_scaled)
174-
fig2 = plt.figure(figsize=(12, 8))
175+
fig2 = plt.figure(figsize=(8, 6))
175176
for k in sorted(set(labels)):
176177
idx = labels == k
177178
plt.scatter(
-54 Bytes
Binary file not shown.
-352 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

tmp_plots/output/Scatter_plot.pdf

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)