From 782ce4e86508995ee57c651295b4bfe6bc13a75e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 8 Jan 2026 16:03:22 +0000 Subject: [PATCH 1/5] feat(highcharts): implement network-weighted --- .../implementations/highcharts.py | 267 ++++++++++++++++++ 1 file changed, 267 insertions(+) create mode 100644 plots/network-weighted/implementations/highcharts.py diff --git a/plots/network-weighted/implementations/highcharts.py b/plots/network-weighted/implementations/highcharts.py new file mode 100644 index 0000000000..272762159e --- /dev/null +++ b/plots/network-weighted/implementations/highcharts.py @@ -0,0 +1,267 @@ +"""pyplots.ai +network-weighted: Weighted Network Graph with Edge Thickness +Library: highcharts | Python 3.13 +Quality: pending | Created: 2026-01-08 +""" + +import json +import tempfile +import time +import urllib.request +from pathlib import Path + +import numpy as np +from selenium import webdriver +from selenium.webdriver.chrome.options import Options + + +# Data: Research collaboration network between university departments +np.random.seed(42) + +# Departments (nodes) +departments = [ + {"id": "CS", "name": "Computer Science"}, + {"id": "MATH", "name": "Mathematics"}, + {"id": "PHYS", "name": "Physics"}, + {"id": "STAT", "name": "Statistics"}, + {"id": "EE", "name": "Electrical Eng."}, + {"id": "ME", "name": "Mechanical Eng."}, + {"id": "BIO", "name": "Biology"}, + {"id": "CHEM", "name": "Chemistry"}, + {"id": "ECON", "name": "Economics"}, + {"id": "PSYCH", "name": "Psychology"}, + {"id": "MED", "name": "Medicine"}, + {"id": "ENV", "name": "Environmental Sci."}, +] + +# Collaboration edges with weights (number of joint publications) +edges = [ + ("CS", "MATH", 45), + ("CS", "STAT", 38), + ("CS", "EE", 52), + ("CS", "PHYS", 22), + ("MATH", "STAT", 41), + ("MATH", "PHYS", 35), + ("MATH", "ECON", 18), + ("PHYS", "EE", 28), + ("PHYS", "CHEM", 25), + ("STAT", "ECON", 32), + ("STAT", "PSYCH", 24), + ("STAT", "BIO", 19), + ("EE", "ME", 33), + ("BIO", "CHEM", 47), + ("BIO", "MED", 55), + ("CHEM", "ENV", 29), + ("MED", "PSYCH", 21), + ("MED", "BIO", 55), + ("ENV", "BIO", 26), + ("ECON", "PSYCH", 15), +] + +# Calculate weighted degree for node sizing +weighted_degree = {d["id"]: 0 for d in departments} +for src, tgt, w in edges: + weighted_degree[src] += w + weighted_degree[tgt] += w + +# Normalize for marker size (bigger nodes = more collaborations) +max_degree = max(weighted_degree.values()) +min_degree = min(weighted_degree.values()) + +# Colors for nodes - colorblind-safe palette +colors = [ + "#306998", + "#FFD43B", + "#9467BD", + "#17BECF", + "#8C564B", + "#E377C2", + "#7F7F7F", + "#BCBD22", + "#1F77B4", + "#FF7F0E", + "#2CA02C", + "#D62728", +] + +# Create nodes for Highcharts networkgraph +nodes_data = [] +for i, dept in enumerate(departments): + deg = weighted_degree[dept["id"]] + # Scale marker size between 50 and 120 based on weighted degree + marker_size = 50 + 70 * (deg - min_degree) / (max_degree - min_degree) + nodes_data.append( + {"id": dept["id"], "name": dept["name"], "marker": {"radius": marker_size}, "color": colors[i % len(colors)]} + ) + +# Create links with width based on weight +# Scale line width between 4 and 24 based on weight +min_weight = min(w for _, _, w in edges) +max_weight = max(w for _, _, w in edges) + +links_data = [] +for src, tgt, weight in edges: + width = 4 + 20 * (weight - min_weight) / (max_weight - min_weight) + links_data.append({"from": src, "to": tgt, "width": round(width, 1)}) + +# Convert links and nodes to JSON for embedding +links_json = json.dumps(links_data) +nodes_json = json.dumps(nodes_data) + +# Download Highcharts JS and networkgraph module +highcharts_url = "https://code.highcharts.com/highcharts.js" +networkgraph_url = "https://code.highcharts.com/modules/networkgraph.js" + +with urllib.request.urlopen(highcharts_url, timeout=30) as response: + highcharts_js = response.read().decode("utf-8") + +with urllib.request.urlopen(networkgraph_url, timeout=30) as response: + networkgraph_js = response.read().decode("utf-8") + +# Generate HTML with inline scripts and custom link width rendering +html_content = f""" + + + + + + + + +
+ + +""" + +# Write temp HTML and take screenshot +with tempfile.NamedTemporaryFile(mode="w", suffix=".html", delete=False, encoding="utf-8") as f: + f.write(html_content) + temp_path = f.name + +# Also save as plot.html for interactive viewing +with open("plot.html", "w", encoding="utf-8") as f: + f.write(html_content) + +chrome_options = Options() +chrome_options.add_argument("--headless") +chrome_options.add_argument("--no-sandbox") +chrome_options.add_argument("--disable-dev-shm-usage") +chrome_options.add_argument("--disable-gpu") +chrome_options.add_argument("--window-size=4900,2800") + +driver = webdriver.Chrome(options=chrome_options) +driver.get(f"file://{temp_path}") +time.sleep(10) # Wait for network simulation to settle +driver.save_screenshot("plot.png") +driver.quit() + +Path(temp_path).unlink() # Clean up temp file From f7a1cb12f9fd6a8ab679e95e64fe4e9a2133a3e1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 8 Jan 2026 16:03:42 +0000 Subject: [PATCH 2/5] chore(highcharts): add metadata for network-weighted --- .../network-weighted/metadata/highcharts.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plots/network-weighted/metadata/highcharts.yaml diff --git a/plots/network-weighted/metadata/highcharts.yaml b/plots/network-weighted/metadata/highcharts.yaml new file mode 100644 index 0000000000..0636c3b52d --- /dev/null +++ b/plots/network-weighted/metadata/highcharts.yaml @@ -0,0 +1,19 @@ +# Per-library metadata for highcharts implementation of network-weighted +# Auto-generated by impl-generate.yml + +library: highcharts +specification_id: network-weighted +created: '2026-01-08T16:03:42Z' +updated: '2026-01-08T16:03:42Z' +generated_by: claude-opus-4-5-20251101 +workflow_run: 20822859689 +issue: 3290 +python_version: 3.13.11 +library_version: unknown +preview_url: https://storage.googleapis.com/pyplots-images/plots/network-weighted/highcharts/plot.png +preview_thumb: https://storage.googleapis.com/pyplots-images/plots/network-weighted/highcharts/plot_thumb.png +preview_html: https://storage.googleapis.com/pyplots-images/plots/network-weighted/highcharts/plot.html +quality_score: null +review: + strengths: [] + weaknesses: [] From 63baff11568c93bc886358f4b414fa002859d331 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 8 Jan 2026 16:10:58 +0000 Subject: [PATCH 3/5] chore(highcharts): update quality score 82 and review feedback for network-weighted --- .../implementations/highcharts.py | 6 +- .../network-weighted/metadata/highcharts.yaml | 208 +++++++++++++++++- 2 files changed, 204 insertions(+), 10 deletions(-) diff --git a/plots/network-weighted/implementations/highcharts.py b/plots/network-weighted/implementations/highcharts.py index 272762159e..e4e8ff1b18 100644 --- a/plots/network-weighted/implementations/highcharts.py +++ b/plots/network-weighted/implementations/highcharts.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai network-weighted: Weighted Network Graph with Edge Thickness -Library: highcharts | Python 3.13 -Quality: pending | Created: 2026-01-08 +Library: highcharts unknown | Python 3.13.11 +Quality: 82/100 | Created: 2026-01-08 """ import json diff --git a/plots/network-weighted/metadata/highcharts.yaml b/plots/network-weighted/metadata/highcharts.yaml index 0636c3b52d..11ec76e1a8 100644 --- a/plots/network-weighted/metadata/highcharts.yaml +++ b/plots/network-weighted/metadata/highcharts.yaml @@ -1,10 +1,7 @@ -# Per-library metadata for highcharts implementation of network-weighted -# Auto-generated by impl-generate.yml - library: highcharts specification_id: network-weighted created: '2026-01-08T16:03:42Z' -updated: '2026-01-08T16:03:42Z' +updated: '2026-01-08T16:10:58Z' generated_by: claude-opus-4-5-20251101 workflow_run: 20822859689 issue: 3290 @@ -13,7 +10,204 @@ library_version: unknown preview_url: https://storage.googleapis.com/pyplots-images/plots/network-weighted/highcharts/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/network-weighted/highcharts/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/network-weighted/highcharts/plot.html -quality_score: null +quality_score: 82 review: - strengths: [] - weaknesses: [] + strengths: + - Excellent colorblind-safe palette with 12 distinct node colors + - Node sizing by weighted degree effectively shows collaboration hubs + - Good use of Highcharts networkgraph module with force-directed layout + - Clean subtitle explains the weight encoding + - Proper white text outlines ensure label legibility + weaknesses: + - No legend explaining the edge weight scale (spec recommends a legend or annotation + explaining the weight scale) + - Network graph is offset to the right with ~60% empty whitespace on the left side + of canvas + - Uses raw JavaScript/HTML generation instead of highcharts-core Python API + image_description: The plot displays a weighted network graph representing university + department collaborations. There are 12 circular nodes of varying sizes (CS, MATH, + PHYS, STAT, EE, ME, BIO, CHEM, ECON, PSYCH, MED, ENV) connected by edges of varying + thickness. Node sizes reflect weighted degree (total collaboration strength), + with CS and BIO being among the largest. Edge colors are a consistent dark blue + (#306998), with thickness clearly varying to show collaboration intensity (thickest + edges include BIO-MED and CS-EE). Each node has a distinct color from a colorblind-safe + palette (blue, yellow, purple, cyan, brown, pink, gray, olive, orange, green, + red). Labels appear both inside larger nodes and outside smaller ones with white + text outlines for legibility. The title "network-weighted · highcharts · pyplots.ai" + appears at the top with a descriptive subtitle explaining that edge thickness + represents joint publications. The network is positioned center-right on the canvas + with notable whitespace on the left side. + criteria_checklist: + visual_quality: + score: 32 + max: 40 + items: + - id: VQ-01 + name: Text Legibility + score: 8 + max: 10 + passed: true + comment: Title and labels readable, but some node labels placed outside nodes + are smaller relative to canvas size + - id: VQ-02 + name: No Overlap + score: 7 + max: 8 + passed: true + comment: Minor label positioning issues but generally readable + - id: VQ-03 + name: Element Visibility + score: 7 + max: 8 + passed: true + comment: Nodes well-sized, edge thickness differentiation visible but could + be more pronounced + - id: VQ-04 + name: Color Accessibility + score: 5 + max: 5 + passed: true + comment: Excellent colorblind-safe palette with 12 distinct colors + - id: VQ-05 + name: Layout Balance + score: 3 + max: 5 + passed: false + comment: Network occupies ~35% of canvas, offset to right with empty space + on left + - id: VQ-06 + name: Axis Labels + score: 2 + max: 2 + passed: true + comment: N/A for network graph - subtitle explains edge meaning appropriately + - id: VQ-07 + name: Grid & Legend + score: 0 + max: 2 + passed: false + comment: No legend for edge weight scale as recommended by spec + spec_compliance: + score: 22 + max: 25 + items: + - id: SC-01 + name: Plot Type + score: 8 + max: 8 + passed: true + comment: Correct weighted network graph + - id: SC-02 + name: Data Mapping + score: 5 + max: 5 + passed: true + comment: Nodes represent departments, edges represent collaborations with + weight + - id: SC-03 + name: Required Features + score: 4 + max: 5 + passed: false + comment: Missing legend/annotation explaining weight scale as suggested in + spec notes + - id: SC-04 + name: Data Range + score: 3 + max: 3 + passed: true + comment: All nodes and edges visible + - id: SC-05 + name: Legend Accuracy + score: 0 + max: 2 + passed: false + comment: No legend present for weight interpretation + - id: SC-06 + name: Title Format + score: 2 + max: 2 + passed: true + comment: 'Correct format: network-weighted · highcharts · pyplots.ai' + data_quality: + score: 18 + max: 20 + items: + - id: DQ-01 + name: Feature Coverage + score: 7 + max: 8 + passed: true + comment: Shows varying edge weights and node sizing by degree + - id: DQ-02 + name: Realistic Context + score: 7 + max: 7 + passed: true + comment: University department collaboration is a realistic, neutral scenario + - id: DQ-03 + name: Appropriate Scale + score: 4 + max: 5 + passed: true + comment: Publication counts (15-55) are reasonable for academic collaboration + code_quality: + score: 8 + max: 10 + items: + - id: CQ-01 + name: KISS Structure + score: 3 + max: 3 + passed: true + comment: 'Linear flow: imports → data → processing → HTML → screenshot' + - id: CQ-02 + name: Reproducibility + score: 3 + max: 3 + passed: true + comment: np.random.seed(42) set + - id: CQ-03 + name: Clean Imports + score: 2 + max: 2 + passed: true + comment: All imports used + - id: CQ-04 + name: No Deprecated API + score: 0 + max: 1 + passed: false + comment: Uses inline JavaScript manipulation rather than highcharts-core Python + API + - id: CQ-05 + name: Output Correct + score: 0 + max: 1 + passed: true + comment: Saves as plot.png correctly + library_features: + score: 2 + max: 5 + items: + - id: LF-01 + name: Distinctive Features + score: 2 + max: 5 + passed: false + comment: Uses networkgraph module but bypasses highcharts-core Python API + in favor of raw JavaScript + verdict: REJECTED +impl_tags: + dependencies: + - selenium + techniques: + - html-export + - hover-tooltips + patterns: + - data-generation + - iteration-over-groups + dataprep: + - normalization + styling: + - alpha-blending From 5e756fca8d2cf9db8a0d640dd398d35104153630 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 8 Jan 2026 16:17:13 +0000 Subject: [PATCH 4/5] fix(highcharts): address review feedback for network-weighted - Add edge weight legend explaining publication count scale (15-55) - Improve layout balance with symmetric margins (400px left/right) - Center network graph better in canvas area - Increase gravitational constant for tighter clustering - Update layout algorithm parameters for better node distribution Attempt 1/3 - fixes based on AI review --- .../implementations/highcharts.py | 79 ++++++++++++++++--- 1 file changed, 68 insertions(+), 11 deletions(-) diff --git a/plots/network-weighted/implementations/highcharts.py b/plots/network-weighted/implementations/highcharts.py index e4e8ff1b18..609b1b03dc 100644 --- a/plots/network-weighted/implementations/highcharts.py +++ b/plots/network-weighted/implementations/highcharts.py @@ -1,4 +1,4 @@ -""" pyplots.ai +"""pyplots.ai network-weighted: Weighted Network Graph with Edge Thickness Library: highcharts unknown | Python 3.13.11 Quality: 82/100 | Created: 2026-01-08 @@ -118,7 +118,7 @@ with urllib.request.urlopen(networkgraph_url, timeout=30) as response: networkgraph_js = response.read().decode("utf-8") -# Generate HTML with inline scripts and custom link width rendering +# Generate HTML with inline scripts, weight legend, and custom link width rendering html_content = f""" @@ -128,10 +128,58 @@
+
+

Edge Weight (Publications)

+
+
+ {min_weight} publications +
+
+
+ ~{(min_weight + max_weight) // 2} publications +
+
+
+ {max_weight} publications +
+