-
Notifications
You must be signed in to change notification settings - Fork 0
update(dendrogram-basic): letsplot — comprehensive quality review #5208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
51c79f6
646e1e1
fb938f0
245140e
2a8d8f5
030983f
13573d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||||||||||||
| """ pyplots.ai | ||||||||||||||||
| dendrogram-basic: Basic Dendrogram | ||||||||||||||||
| Library: letsplot 4.8.2 | Python 3.13.11 | ||||||||||||||||
| Quality: 91/100 | Created: 2025-12-23 | ||||||||||||||||
| Library: letsplot 4.8.2 | Python 3.14.3 | ||||||||||||||||
| Quality: 85/100 | Updated: 2026-04-05 | ||||||||||||||||
|
||||||||||||||||
| """ | ||||||||||||||||
|
|
||||||||||||||||
| import numpy as np | ||||||||||||||||
|
|
@@ -10,12 +10,14 @@ | |||||||||||||||
| LetsPlot, | ||||||||||||||||
| aes, | ||||||||||||||||
| element_blank, | ||||||||||||||||
| element_line, | ||||||||||||||||
| element_text, | ||||||||||||||||
| geom_segment, | ||||||||||||||||
| geom_text, | ||||||||||||||||
| ggplot, | ||||||||||||||||
| ggsize, | ||||||||||||||||
| labs, | ||||||||||||||||
| layer_tooltips, | ||||||||||||||||
| scale_color_manual, | ||||||||||||||||
| scale_x_continuous, | ||||||||||||||||
| scale_y_continuous, | ||||||||||||||||
|
|
@@ -24,132 +26,131 @@ | |||||||||||||||
| ) | ||||||||||||||||
| from lets_plot.export import ggsave | ||||||||||||||||
| from scipy.cluster.hierarchy import linkage | ||||||||||||||||
| from sklearn.datasets import load_iris | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| LetsPlot.setup_html() | ||||||||||||||||
|
|
||||||||||||||||
| # Data - Iris flower measurements (4 features for 15 samples) | ||||||||||||||||
| # Data - Iris flower measurements (15 samples, 3 species) | ||||||||||||||||
| iris = load_iris() | ||||||||||||||||
| np.random.seed(42) | ||||||||||||||||
| indices = np.sort(np.concatenate([np.random.choice(np.where(iris.target == k)[0], 5, replace=False) for k in range(3)])) | ||||||||||||||||
| features = iris.data[indices] | ||||||||||||||||
| species_names = ["Setosa", "Versicolor", "Virginica"] | ||||||||||||||||
| labels = [f"{species_names[iris.target[i]]}-{j + 1}" for j, i in enumerate(indices)] | ||||||||||||||||
|
||||||||||||||||
| labels = [f"{species_names[iris.target[i]]}-{j + 1}" for j, i in enumerate(indices)] | |
| species_counts = {k: 0 for k in range(len(species_names))} | |
| labels = [] | |
| for i in indices: | |
| species_id = int(iris.target[i]) | |
| species_counts[species_id] += 1 | |
| labels.append(f"{species_names[species_id]}-{species_counts[species_id]}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file uses
"""pyplots.aiwhile many other letsplot implementations in the repo use""" pyplots.ai(note the space) in the standard 4-line header. Consider matching the common header formatting for consistency across generated plot scripts.