Skip to content

Commit faed1cd

Browse files
chore(matplotlib): update quality score 89 and review feedback for network-force-directed
1 parent 24c4667 commit faed1cd

2 files changed

Lines changed: 281 additions & 9 deletions

File tree

plots/network-force-directed/implementations/python/matplotlib.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
"""anyplot.ai
1+
""" anyplot.ai
22
network-force-directed: Force-Directed Graph
3-
Library: matplotlib | Python
3+
Library: matplotlib 3.11.0 | Python 3.13.14
4+
Quality: 89/100 | Updated: 2026-07-01
45
"""
56

67
import os
Lines changed: 278 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# Per-library metadata for matplotlib implementation of network-force-directed
2-
# Auto-generated by impl-generate.yml
3-
41
library: matplotlib
52
language: python
63
specification_id: network-force-directed
74
created: '2025-12-23T15:14:17Z'
8-
updated: '2026-07-01T01:15:35Z'
5+
updated: '2026-07-01T01:24:15Z'
96
generated_by: claude-sonnet
107
workflow_run: 28486437476
118
issue: 990
@@ -15,7 +12,281 @@ preview_url_light: https://storage.googleapis.com/anyplot-images/plots/network-f
1512
preview_url_dark: https://storage.googleapis.com/anyplot-images/plots/network-force-directed/python/matplotlib/plot-dark.png
1613
preview_html_light: null
1714
preview_html_dark: null
18-
quality_score: null
15+
quality_score: 89
1916
review:
20-
strengths: []
21-
weaknesses: []
17+
strengths:
18+
- Full Fruchterman-Reingold force-directed algorithm implemented from scratch in
19+
NumPy with proper cooling schedule (200 iterations, temperature decay) — layout
20+
stabilizes naturally and reveals community structure
21+
- 'Dual edge encoding: subtle solid lines (alpha=0.22) for dense intra-community
22+
connections vs dashed lines (alpha=0.65) for sparse cross-team bridges — communicates
23+
network hierarchy elegantly'
24+
- Degree-based node sizing (s=80+degree×12) makes hub nodes visually prominent,
25+
reinforcing the hub annotation system
26+
- Hub annotation system labels top-2 nodes per community with styled rounded background
27+
boxes (ELEVATED_BG + no edge) — only key nodes labeled, avoiding clutter as spec
28+
recommends
29+
- 'Full Imprint palette compliance: Engineering #009E73, Marketing #C475FD, Sales
30+
#4467A3 in canonical order; theme-adaptive chrome correct in both renders'
31+
- LineCollection for batch edge rendering (two separate collections for intra vs
32+
bridge) — idiomatic matplotlib pattern, far more efficient than 133 individual
33+
line.plot() calls
34+
- Canvas correctly sized at 3200×1800 px (figsize=(8,4.5) dpi=400), no bbox_inches='tight',
35+
uses fig.subplots_adjust() per library spec
36+
weaknesses:
37+
- 'SC-04 TITLE FORMAT: Title is ''network-force-directed · matplotlib · anyplot.ai''
38+
— missing the required language component. Correct format is ''network-force-directed
39+
· python · matplotlib · anyplot.ai'' (spec requires {spec-id} · {language} · {library}
40+
· anyplot.ai, language ∈ {python, r, julia}). Fix: change the title string to
41+
include ''· python ·'' between the spec-id and the library name.'
42+
- 'DE-01 MODERATE: Design is above defaults (dual edge encoding, hub labels, degree
43+
sizing) but does not yet reach strong-design territory — could improve typography
44+
hierarchy (e.g., slightly bolder title weight, sub-title-level annotation for
45+
the footer) and overall polish to push toward 6/8.'
46+
- 'DE-02 MODERATE: Visual refinement is good (axis off, no grid, alpha-differentiated
47+
edges, styled legend) but the whitespace balance could be tighter — the Engineering
48+
cluster is slightly pushed into the right edge of the canvas while the left side
49+
has generous empty space. Consider adjusting force layout parameters or subplots_adjust
50+
to center the network better.'
51+
image_description: |-
52+
Light render (plot-light.png):
53+
Background: Warm off-white (#FAF8F1) — correct, not pure white.
54+
Chrome: Title "network-force-directed · matplotlib · anyplot.ai" in dark ink, medium weight, readable. No axis tick labels (axis off, appropriate for network graph). Legend "Teams" in upper-left with ELEVATED_BG frame and INK_SOFT border; labels "Engineering", "Marketing", "Sales" in INK_SOFT — all readable. Footer note "50 nodes · 133 edges · node size ∝ degree · dashed = cross-team bridges" in muted color — readable. Hub labels (Hub (S), Hub (M), Hub (E)) with rounded background boxes — all readable against background.
55+
Data: Engineering cluster (#009E73, brand green) on right; Marketing cluster (#C475FD, lavender) in lower-center; Sales cluster (#4467A3, blue) upper-left. Intra-community edges rendered as subtle solid gray lines (alpha=0.22); bridge edges rendered as dashed more-visible gray lines (alpha=0.65). Hub nodes visibly larger than regular nodes due to degree-based sizing.
56+
Legibility verdict: PASS — all text elements readable against light background; no light-on-light issues.
57+
58+
Dark render (plot-dark.png):
59+
Background: Near-black (#1A1A17) — correct, warm near-black not pure black.
60+
Chrome: Title text is light-colored and clearly readable against dark background. Legend text (Engineering, Marketing, Sales) in light INK_SOFT (#B8B7B0) — readable against dark elevated background (#242420) legend frame. Hub labels have dark elevated background boxes with light text (#F0EFE8) — no dark-on-dark failures detected. Footer note in muted light color — readable.
61+
Data: Identical Imprint palette data colors to light render — Engineering #009E73, Marketing #C475FD, Sales #4467A3 unchanged. Node edges use dark PAGE_BG (#1A1A17) for definition. Bridge dashed edges more visible, intra-edges subtle — same encoding hierarchy as light render.
62+
Legibility verdict: PASS — all text elements readable against dark background; no dark-on-dark issues; brand green #009E73 clearly visible on dark surface.
63+
criteria_checklist:
64+
visual_quality:
65+
score: 30
66+
max: 30
67+
items:
68+
- id: VQ-01
69+
name: Text Legibility
70+
score: 8
71+
max: 8
72+
passed: true
73+
comment: 'All font sizes explicitly set: title fontsize computed (12 for 49-char
74+
title), hub labels 8pt, legend text 8pt, legend title 10pt, footer 8pt.
75+
Both themes fully readable, well-proportioned.'
76+
- id: VQ-02
77+
name: No Overlap
78+
score: 6
79+
max: 6
80+
passed: true
81+
comment: Hub labels use ELEVATED_BG background boxes ensuring readability
82+
over crossing edges. No text-on-text overlap visible in either render. Hub
83+
labels per community are spatially separated.
84+
- id: VQ-03
85+
name: Element Visibility
86+
score: 6
87+
max: 6
88+
passed: true
89+
comment: '50 nodes with s=80+12*degree — hub nodes prominently larger. Node
90+
alpha=0.92. Two LineCollections: intra-edges alpha=0.22 (subtle, dense),
91+
bridge-edges alpha=0.65 dashed (visible). Density-appropriate.'
92+
- id: VQ-04
93+
name: Color Accessibility
94+
score: 2
95+
max: 2
96+
passed: true
97+
comment: Imprint palette positions 1-3 used (green/purple/blue) — CVD-safe
98+
combination. Node edges use PAGE_BG for definition against backgrounds.
99+
No red-green as sole signal.
100+
- id: VQ-05
101+
name: Layout & Canvas
102+
score: 4
103+
max: 4
104+
passed: true
105+
comment: Network fills ~70% of canvas. Legend upper-left, not overlapping
106+
main data. Footer at bottom. Canvas 3200x1800 correct. Canvas gate passed
107+
(no gate file found).
108+
- id: VQ-06
109+
name: Axis Labels & Title
110+
score: 2
111+
max: 2
112+
passed: true
113+
comment: 'No axis labels needed (axis off for network graph). Title correct
114+
per format. Footer note provides data descriptor: ''50 nodes · 133 edges
115+
· node size ∝ degree · dashed = cross-team bridges''.'
116+
- id: VQ-07
117+
name: Palette Compliance
118+
score: 2
119+
max: 2
120+
passed: true
121+
comment: 'First series Engineering = #009E73 (brand green). Marketing = #C475FD
122+
(pos 2). Sales = #4467A3 (pos 3). Canonical Imprint order. Backgrounds #FAF8F1
123+
light / #1A1A17 dark. Theme-adaptive chrome correct in both renders.'
124+
design_excellence:
125+
score: 13
126+
max: 20
127+
items:
128+
- id: DE-01
129+
name: Aesthetic Sophistication
130+
score: 5
131+
max: 8
132+
passed: true
133+
comment: 'Above well-configured defaults: dual edge encoding (alpha+linestyle+linewidth
134+
differentiation), degree-based node sizing, hub annotation system with styled
135+
boxes. Not yet at strong-design/FiveThirtyEight level — typography could
136+
be more intentional.'
137+
- id: DE-02
138+
name: Visual Refinement
139+
score: 4
140+
max: 6
141+
passed: true
142+
comment: 'Good refinement: axis off (very clean), no grid, alpha-differentiated
143+
edges, styled legend with ELEVATED_BG frame, footer in muted color. Could
144+
improve canvas whitespace balance — Engineering cluster slightly right-heavy.'
145+
- id: DE-03
146+
name: Data Storytelling
147+
score: 4
148+
max: 6
149+
passed: true
150+
comment: 'Visual hierarchy guides the reader: hub labels call out key connectors
151+
per team, bridge edges highlighted (dashed, more visible) to reveal cross-team
152+
structure. Story: 3 departments with strong internal cohesion and sparse
153+
but important cross-team bridges.'
154+
spec_compliance:
155+
score: 14
156+
max: 15
157+
items:
158+
- id: SC-01
159+
name: Plot Type
160+
score: 5
161+
max: 5
162+
passed: true
163+
comment: Correct force-directed graph. Fruchterman-Reingold algorithm implemented
164+
with repulsive forces (all-pairs) and attractive forces (edges only), cooling
165+
schedule over 200 iterations.
166+
- id: SC-02
167+
name: Required Features
168+
score: 4
169+
max: 4
170+
passed: true
171+
comment: 50 nodes (within 20-200 range), 133 edges, node size scaling by degree,
172+
labels for key nodes only (top-2 per community), sufficient iterations (200).
173+
Optional edge weight not implemented (spec marks as optional).
174+
- id: SC-03
175+
name: Data Mapping
176+
score: 3
177+
max: 3
178+
passed: true
179+
comment: Node positions from force-directed layout. Community color mapping
180+
correct. Edge connections match defined adjacency. All 50 nodes visible.
181+
- id: SC-04
182+
name: Title & Legend
183+
score: 2
184+
max: 3
185+
passed: false
186+
comment: 'TITLE FORMAT WRONG: Implementation has ''network-force-directed
187+
· matplotlib · anyplot.ai'' — missing the required language component. Correct
188+
format: ''network-force-directed · python · matplotlib · anyplot.ai''. Legend
189+
labels correct: Engineering, Marketing, Sales with legend title ''Teams''.'
190+
data_quality:
191+
score: 15
192+
max: 15
193+
items:
194+
- id: DQ-01
195+
name: Feature Coverage
196+
score: 6
197+
max: 6
198+
passed: true
199+
comment: 'Shows all force-directed graph aspects: community clustering, degree
200+
variation, intra-community density vs cross-community sparsity, bridge structure,
201+
node size variation.'
202+
- id: DQ-02
203+
name: Realistic Context
204+
score: 5
205+
max: 5
206+
passed: true
207+
comment: 50-person company social network with 3 departments (Engineering
208+
18, Marketing 17, Sales 15). Realistic scenario, neutral business context,
209+
no controversial elements.
210+
- id: DQ-03
211+
name: Appropriate Scale
212+
score: 4
213+
max: 4
214+
passed: true
215+
comment: 50 nodes in spec range (20-200). 30% intra-community connection probability
216+
is realistic. 8 bridge edges is sparse (realistic for cross-team). Department
217+
sizes (18,17,15) plausible. 133 total edges.
218+
code_quality:
219+
score: 10
220+
max: 10
221+
items:
222+
- id: CQ-01
223+
name: KISS Structure
224+
score: 3
225+
max: 3
226+
passed: true
227+
comment: 'Flat linear structure: imports → constants → data generation → FR
228+
algorithm → plotting → save. No functions or classes.'
229+
- id: CQ-02
230+
name: Reproducibility
231+
score: 2
232+
max: 2
233+
passed: true
234+
comment: np.random.seed(42) set before any random operations.
235+
- id: CQ-03
236+
name: Clean Imports
237+
score: 2
238+
max: 2
239+
passed: true
240+
comment: os (ANYPLOT_THEME), pathlib (OUTPUT_DIR), matplotlib.pyplot, numpy,
241+
matplotlib.collections.LineCollection — all imports are used.
242+
- id: CQ-04
243+
name: Code Elegance
244+
score: 2
245+
max: 2
246+
passed: true
247+
comment: No fake interactive elements. FR algorithm in pure NumPy is appropriate
248+
given no networkx dependency. Per-node scatter loop is slightly verbose
249+
(50 calls vs 3 batched by community) but functional. No over-engineering.
250+
- id: CQ-05
251+
name: Output & API
252+
score: 1
253+
max: 1
254+
passed: true
255+
comment: Saves as plot-{THEME}.png with dpi=400, facecolor=PAGE_BG. No bbox_inches='tight'.
256+
No deprecated API calls.
257+
library_mastery:
258+
score: 7
259+
max: 10
260+
items:
261+
- id: LM-01
262+
name: Idiomatic Usage
263+
score: 4
264+
max: 5
265+
passed: true
266+
comment: 'Uses ax methods throughout. LineCollection for batch edge rendering
267+
(correct idiomatic approach). fig.text() for footer. Custom legend with
268+
explicit handles. Minor: nodes drawn with 50 individual scatter() calls
269+
instead of 3 batched by community.'
270+
- id: LM-02
271+
name: Distinctive Features
272+
score: 3
273+
max: 5
274+
passed: true
275+
comment: Two LineCollections for batch edge rendering (distinctly matplotlib
276+
— much faster than 133 individual plot() calls). Dual alpha/linestyle/linewidth
277+
encoding in separate collections. Custom legend handles. Algorithm itself
278+
is pure NumPy, not matplotlib-specific.
279+
verdict: REJECTED
280+
impl_tags:
281+
dependencies: []
282+
techniques:
283+
- annotations
284+
- custom-legend
285+
patterns:
286+
- data-generation
287+
- iteration-over-groups
288+
dataprep:
289+
- normalization
290+
styling:
291+
- minimal-chrome
292+
- alpha-blending

0 commit comments

Comments
 (0)