Skip to content

feat(seaborn): implement tree-phylogenetic#3108

Merged
github-actions[bot] merged 6 commits intomainfrom
implementation/tree-phylogenetic/seaborn
Dec 31, 2025
Merged

feat(seaborn): implement tree-phylogenetic#3108
github-actions[bot] merged 6 commits intomainfrom
implementation/tree-phylogenetic/seaborn

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: tree-phylogenetic - seaborn

Implements the seaborn version of tree-phylogenetic.

File: plots/tree-phylogenetic/implementations/seaborn.py

Parent Issue: #3070


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Dec 31, 2025

AI Review - Attempt 1/3

Image Description

The plot displays a horizontal dendrogram (phylogenetic tree) showing the evolutionary relationships between 10 primate species. The tree is oriented with the root on the left and species labels on the right. Species names are color-coded by clade: Great Apes (Human, Chimpanzee, Gorilla) in dark blue, Lesser Apes (Orangutan, Gibbon) in light blue, Old World Monkeys (Baboon, Macaque) in yellow/orange, New World Monkeys (Marmoset) in green, and Prosimians (Lemur, Tarsier) in red. The x-axis shows "Evolutionary Distance (Million Years)" ranging from 0 to ~55. A legend in the lower-left identifies the five clades. The title follows the required format. Branch connections are drawn in shades of green and gray. A scale annotation appears in the lower right.

Quality Score: 88/100

Criteria Checklist

Visual Quality (36/40 pts)

  • VQ-01: Text Legibility (9/10) - Title at 24pt, axis labels at 20pt, species labels at 18pt - all clearly readable, slightly under optimal for tick labels
  • VQ-02: No Overlap (8/8) - No overlapping text, all species labels clearly separated
  • VQ-03: Element Visibility (7/8) - Branch lines are visible but could be thicker for better visibility
  • VQ-04: Color Accessibility (5/5) - Colors are distinct and colorblind-friendly (blue, yellow, green, red are distinguishable)
  • VQ-05: Layout Balance (5/5) - Good use of canvas, tree fills appropriate space, legend well-positioned
  • VQ-06: Axis Labels (2/2) - X-axis has descriptive label with units "Evolutionary Distance (Million Years)"
  • VQ-07: Grid & Legend (0/2) - Grid is subtle at alpha=0.3, but legend colors don't match branch colors (legend shows clade colors but branches use default dendrogram coloring)

Spec Compliance (22/25 pts)

  • SC-01: Plot Type (8/8) - Correct phylogenetic tree/dendrogram visualization
  • SC-02: Data Mapping (5/5) - Branch lengths correctly represent evolutionary distances
  • SC-03: Required Features (4/5) - Has species labels, branch lengths, clade coloring, scale annotation; missing actual proportional branch coloring by clade
  • SC-04: Data Range (3/3) - All data visible, 0-55 million years shown
  • SC-05: Legend Accuracy (0/2) - Legend shows clade colors but the actual branch lines don't match these colors (branches are green/gray)
  • SC-06: Title Format (2/2) - Correct format: "Primate Evolution · tree-phylogenetic · seaborn · pyplots.ai"

Data Quality (20/20 pts)

  • DQ-01: Feature Coverage (8/8) - Shows diverse clades, varying branch lengths, multiple evolutionary distances
  • DQ-02: Realistic Context (7/7) - Primate evolution is a well-known, neutral scientific topic with plausible divergence times
  • DQ-03: Appropriate Scale (5/5) - Evolutionary distances (6-58 MYA) match known primate divergence estimates

Code Quality (8/10 pts)

  • CQ-01: KISS Structure (3/3) - Linear flow: imports → data → plot → save
  • CQ-02: Reproducibility (3/3) - np.random.seed(42) set (though not strictly needed as data is deterministic)
  • CQ-03: Clean Imports (0/2) - numpy random seed is set but never used for random operations; Patch import used but could be simplified
  • CQ-04: No Deprecated API (1/1) - Uses current scipy and seaborn APIs
  • CQ-05: Output Correct (1/1) - Saves as plot.png

Library Features (2/5 pts)

  • LF-01: Uses distinctive library features (2/5) - Uses sns.set_theme() and sns.despine() for styling, but the core dendrogram is from scipy, not a seaborn plotting function. This is acceptable since seaborn doesn't have a native phylogenetic tree function.

Strengths

  • Excellent data representation with realistic primate evolutionary distances based on mitochondrial DNA
  • Clean horizontal dendrogram layout with good canvas utilization
  • Species labels are color-coded by clade for easy identification
  • Proper title format following pyplots.ai conventions
  • Scale annotation provides context for interpreting branch lengths

Weaknesses

  • Legend colors do not match the actual branch colors in the dendrogram (legend shows 5 distinct clade colors but branches are green/gray from scipy's default color_threshold)
  • Branch coloring should reflect the clade groups shown in the legend for visual consistency
  • Could benefit from thicker branch lines for improved visibility at full resolution

Verdict: REJECTED

@github-actions github-actions Bot added the quality:88 Quality score: 88/100 label Dec 31, 2025
@github-actions github-actions Bot added ai-rejected Quality not OK, triggers update ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels Dec 31, 2025
- Branch colors now match legend clade colors (prosimians red, Old World
  Monkeys yellow, New World Monkeys green, Lesser Apes light blue, Great Apes
  dark blue)
- Internal branches inherit clade color when children share same color,
  otherwise use neutral gray for mixed ancestry
- Increased branch line width to 3 for improved visibility at full resolution

Attempt 1/3 - fixes based on AI review
@github-actions
Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 1/3

Applied fixes based on AI review feedback.

Status: Repair completed, re-triggering review...


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Dec 31, 2025

AI Review - Attempt 2/3

Image Description

The plot displays a horizontal phylogenetic tree (dendrogram) showing primate evolutionary relationships. The tree branches from left to right, with 10 species labels on the right edge (Tarsier, Lemur, Chimpanzee, Human, Gorilla, Orangutan, Gibbon, Macaque, Baboon, Marmoset). Branch colors encode clades: red for Prosimians (Tarsier, Lemur), dark blue for Great Apes (Human, Chimpanzee, Gorilla), light blue for Lesser Apes (Orangutan, Gibbon), yellow/gold for Old World Monkeys (Baboon, Macaque), and green for New World Monkeys (Marmoset). The x-axis shows "Evolutionary Distance (Million Years)" from 50 to 0. A legend in the lower-left identifies the 5 clades. The title reads "Primate Evolution · tree-phylogenetic · seaborn · pyplots.ai". Branch lines are thick (3px) and species labels are colored to match their clade.

Quality Score: 91/100

Criteria Checklist

Visual Quality (37/40 pts)

  • VQ-01: Text Legibility (10/10) - Title 24pt, axis label 20pt, tick labels 16-18pt, all perfectly readable
  • VQ-02: No Overlap (8/8) - No overlapping text, all species labels clearly separated
  • VQ-03: Element Visibility (8/8) - Branch lines thick (3px), clearly visible against white background
  • VQ-04: Color Accessibility (5/5) - Uses distinct colors (blue, light blue, yellow, green, red) that are distinguishable even for colorblind users
  • VQ-05: Layout Balance (4/5) - Good use of canvas, tree fills space well, minor issue with legend positioning in lower-left away from some data
  • VQ-06: Axis Labels (2/2) - Descriptive with units: "Evolutionary Distance (Million Years)"
  • VQ-07: Grid & Legend (0/2) - Grid is appropriately subtle (alpha=0.3), but legend is positioned in lower-left which slightly crowds the tree root area

Spec Compliance (23/25 pts)

  • SC-01: Plot Type (8/8) - Correct phylogenetic tree visualization using dendrogram
  • SC-02: Data Mapping (5/5) - Branch lengths proportional to evolutionary distance
  • SC-03: Required Features (4/5) - Has clade coloring, branch lengths, legend. Scale annotation present but could be more prominent (e.g., actual scale bar rather than text annotation)
  • SC-04: Data Range (3/3) - All 10 species visible with full evolutionary timeline
  • SC-05: Legend Accuracy (2/2) - Legend correctly identifies all 5 clades
  • SC-06: Title Format (1/2) - Uses format "{spec-id} · {library} · pyplots.ai" but prepends "Primate Evolution ·" which deviates slightly from spec

Data Quality (19/20 pts)

  • DQ-01: Feature Coverage (8/8) - Shows multiple clades, varying branch lengths, different evolutionary distances
  • DQ-02: Realistic Context (7/7) - Primate evolution based on mitochondrial DNA is a classic, neutral, real-world scenario
  • DQ-03: Appropriate Scale (4/5) - Evolutionary distances are biologically plausible (6-58 MYA range), though some values could be more refined

Code Quality (9/10 pts)

  • CQ-01: KISS Structure (2/3) - Contains a helper function get_link_color() which violates KISS principle of no functions/classes
  • CQ-02: Reproducibility (3/3) - Uses np.random.seed(42)
  • CQ-03: Clean Imports (2/2) - All imports used appropriately
  • CQ-04: No Deprecated API (1/1) - Uses current seaborn/matplotlib API
  • CQ-05: Output Correct (1/1) - Saves as plot.png

Library Features (3/5 pts)

  • LF-01: Distinctive Features (3/5) - Uses sns.set_theme() and sns.despine() for styling, but the core dendrogram is from scipy. Seaborn enhances aesthetics but doesn't provide native tree/dendrogram functions.

Strengths

  • Excellent visual presentation with clear clade-based color coding throughout branches and labels
  • Biologically accurate evolutionary distance matrix for primate species
  • Professional typography with proper font sizes and weights for all text elements
  • Thoughtful color palette using distinct, colorblind-safe colors for 5 clades
  • Clean layout with appropriate use of seaborn's aesthetic styling

Weaknesses

  • Contains a helper function (get_link_color) which violates KISS principle - inline logic preferred
  • Title format includes "Primate Evolution" prefix before spec-id which deviates from standard format

Verdict: APPROVED

@github-actions github-actions Bot added the quality:91 Quality score 91/100 label Dec 31, 2025
@github-actions github-actions Bot added the ai-approved Quality OK, ready for merge label Dec 31, 2025
@github-actions github-actions Bot merged commit 5c39236 into main Dec 31, 2025
2 of 3 checks passed
@github-actions github-actions Bot deleted the implementation/tree-phylogenetic/seaborn branch December 31, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-approved Quality OK, ready for merge ai-attempt-1 First repair attempt quality:88 Quality score: 88/100 quality:91 Quality score 91/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants