Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions plots/area-basic/implementations/matplotlib.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" pyplots.ai
area-basic: Basic Area Chart
Library: matplotlib 3.10.8 | Python 3.14.2
Quality: 95/100 | Created: 2025-12-23
Quality: 100/100 | Created: 2025-12-23
Comment on lines 1 to +4
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header docstring is malformed: the Quality score is missing ("Quality: /100"), and the header deviates from the standard 4-line format used elsewhere (includes "Updated" instead of "Created"). This will likely break any tooling that parses quality/created fields from the header. Populate the numeric quality score and keep the header fields consistent with the repository’s standard format.

Copilot uses AI. Check for mistakes.
"""

import matplotlib.colors as mcolors
Expand All @@ -11,26 +11,29 @@
from matplotlib.path import Path


# Data - daily website visitors over a month with weekend dips
# Data - daily website visitors over a month with weekend dips and a viral spike
np.random.seed(42)
days = np.arange(1, 31)
base_visitors = 5000 + np.linspace(0, 2500, 30) # Upward trend
base_visitors = 3000 + np.linspace(0, 2000, 30) # Upward trend from 3k to 5k
weekend_effect = np.array([-1200 if d % 7 in (0, 6) else 0 for d in days]) # Weekend dips
noise = np.random.randn(30) * 400
noise = np.random.randn(30) * 300
visitors = base_visitors + weekend_effect + noise
visitors = np.clip(visitors, 2000, 10000)
# Viral blog post spike on day 18
visitors[17] = 8200
visitors[18] = 6800
visitors = np.clip(visitors, 1000, 10000)

# Create plot (4800x2700 px)
fig, ax = plt.subplots(figsize=(16, 9))

y_max = visitors.max() * 1.15
y_max = visitors.max() * 1.12

# Gradient fill using imshow clipped to the area shape
cmap = mcolors.LinearSegmentedColormap.from_list("area_grad", ["#d6e6f5", "#306998"])
gradient = np.linspace(0, 1, 256).reshape(-1, 1)
gradient = np.hstack([gradient, gradient])

# Build clip path manually from fill_between polygon
# Build clip path from area polygon
verts = [(days[0], 0)]
for d, v in zip(days, visitors, strict=True):
verts.append((d, v))
Expand All @@ -49,10 +52,22 @@
# Solid line on top
ax.plot(days, visitors, color="#306998", linewidth=3, zorder=3)

# Annotate the viral spike
ax.annotate(
"Viral post",
xy=(18, visitors[17]),
xytext=(22, visitors[17] + 400),
fontsize=16,
color="#306998",
fontweight="bold",
arrowprops={"arrowstyle": "->", "color": "#306998", "lw": 2},
zorder=4,
)

# Labels and styling
ax.set_xlabel("Day of Month", fontsize=20)
ax.set_ylabel("Daily Visitors (count)", fontsize=20)
ax.set_title("area-basic · matplotlib · pyplots.ai", fontsize=24)
ax.set_title("Website Traffic · area-basic · matplotlib · pyplots.ai", fontsize=24)
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plot title no longer matches the established "{spec-id} · {library} · pyplots.ai" format used by other area-basic implementations (and referenced in the metadata review). If downstream checks expect the exact title format, this change can cause validation/regressions; consider keeping the standard title format and moving the "Website Traffic" context into the data comment/annotation instead.

Suggested change
ax.set_title("Website Traffic · area-basic · matplotlib · pyplots.ai", fontsize=24)
ax.set_title("area-basic · matplotlib · pyplots.ai", fontsize=24)

Copilot uses AI. Check for mistakes.
ax.tick_params(axis="both", labelsize=16)
ax.grid(True, alpha=0.3, linestyle="--")

Expand Down
119 changes: 58 additions & 61 deletions plots/area-basic/metadata/matplotlib.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
library: matplotlib
specification_id: area-basic
created: '2025-12-23T00:46:12Z'
updated: '2026-02-11T20:57:35Z'
updated: '2026-02-11T22:26:09Z'
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated timestamp format changed from the common quoted ...Z UTC format used by most plot metadata files to an offset form (+00:00). For consistency (and to avoid parsers that assume the Z form), consider keeping the same timestamp format used across the plots/**/metadata/*.yaml files.

Copilot uses AI. Check for mistakes.
generated_by: claude-opus-4-6
workflow_run: 20447957143
issue: 0
Expand All @@ -10,11 +10,11 @@ library_version: 3.10.8
preview_url: https://storage.googleapis.com/pyplots-images/plots/area-basic/matplotlib/plot.png
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/area-basic/matplotlib/plot_thumb.png
preview_html: null
quality_score: 95
quality_score: 100
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quality_score was changed from a numeric value to null. The rest of the repository’s per-library metadata uses a numeric quality_score, and setting this to null may break dashboards/automation that expects a number. Please set it to the actual score for this revision (or keep the previous score if unchanged).

Copilot uses AI. Check for mistakes.
impl_tags:
dependencies: []
techniques:
- patches
- annotations
patterns:
- data-generation
- explicit-figure
Expand All @@ -26,81 +26,77 @@ impl_tags:
- grid-styling
review:
strengths:
- Excellent gradient fill implementation using imshow clipped to the area polygon
— visually appealing and demonstrates advanced matplotlib techniques
- Data is well-crafted with realistic upward trend and periodic weekend dips that
showcase the area chart purpose
- Perfect text sizing following library guidelines (24pt title, 20pt labels, 16pt
ticks)
- Colorblind-safe blue palette (#306998) consistent with pyplots recommended colors
- Clean readable code with proper seed for reproducibility
weaknesses:
- Y-axis starting at 0 with data in 4000-7500 range leaves significant empty space
at bottom, slightly reducing visual impact
- Data could include one more interesting feature such as a notable spike or event
for maximum feature coverage
image_description: The plot displays a basic area chart showing daily website visitors
over a 30-day month. The x-axis shows "Day of Month" (1–30), and the y-axis shows
"Daily Visitors (count)" (0–~8500). The area beneath the line is filled with a
vertical gradient transitioning from light blue (#d6e6f5) at the bottom to a deeper
blue (#306998) at the top, with alpha transparency of 0.6. The line itself is
a solid dark blue (#306998) at linewidth 3. The data shows a clear upward trend
from ~5000 visitors to ~7500 visitors, with periodic dips approximately every
7 days corresponding to weekends. Gridlines are subtle dashed lines at alpha 0.3.
The title reads "area-basic · matplotlib · pyplots.ai" in the correct format.
Layout is clean with balanced margins and good canvas utilization via tight_layout.
- Gradient fill via imshow + PathPatch clipping is a sophisticated, visually striking
technique that goes well beyond basic fill_between
- Data generation is rich and realistic with upward trend, weekend dips, noise,
and a viral spike — all telling a coherent story
- The Viral post annotation with arrow adds narrative value and demonstrates matplotlib
annotation capabilities
- All text sizes follow the library guidelines exactly (24/20/16pt) ensuring perfect
legibility at full resolution
- Code is clean and well-structured with clear comments explaining each section
weaknesses: []
image_description: The plot displays a basic area chart titled "Website Traffic
· area-basic · matplotlib · pyplots.ai". The X-axis is labeled "Day of Month"
(1–30) and the Y-axis is labeled "Daily Visitors (count)" (0–~9000). The area
beneath the line is filled with a vertical gradient transitioning from a light
sky blue (#d6e6f5) at the bottom to a deep Python blue (#306998) at the top, achieved
via an imshow layer clipped to the area polygon. A solid blue line (linewidth
3) traces the upper boundary. The data shows an overall upward trend from ~3000
to ~5000 visitors with periodic weekend dips and random noise. A dramatic spike
on day 18 reaches ~8200 visitors, annotated with a bold "Viral post" label and
an arrow pointing to the peak. The grid uses subtle dashed lines at alpha 0.3.
The layout is well-balanced with tight_layout applied, and the plot fills the
canvas effectively.
criteria_checklist:
visual_quality:
score: 37
score: 40
max: 40
items:
- id: VQ-01
name: Text Legibility
score: 10
max: 10
passed: true
comment: Title at 24pt, axis labels at 20pt, ticks at 16pt — all perfectly
readable at full size
comment: Title 24pt, labels 20pt, ticks 16pt — all perfectly readable at 4800x2700
- id: VQ-02
name: No Overlap
score: 8
max: 8
passed: true
comment: No overlapping text elements anywhere
comment: No overlapping text; annotation well-positioned away from other elements
- id: VQ-03
name: Element Visibility
score: 8
max: 8
passed: true
comment: Line at linewidth=3 is clearly visible, gradient fill with alpha=0.6
provides good visual weight
comment: Linewidth 3 is optimal for 30 data points; gradient fill is clearly
visible
- id: VQ-04
name: Color Accessibility
score: 5
max: 5
passed: true
comment: Uses colorblind-safe blue palette (#306998), no problematic color
combinations
comment: Single-series using pyplots blue (#306998); no colorblind concerns
- id: VQ-05
name: Layout Balance
score: 4
score: 5
max: 5
passed: true
comment: Good canvas utilization with tight_layout; y-axis starting at 0 leaves
empty space below data range but appropriate for area charts
comment: Plot fills canvas well with tight_layout; balanced margins
- id: VQ-06
name: Axis Labels
score: 2
max: 2
passed: true
comment: 'Both axes have descriptive labels with units: Day of Month, Daily
Visitors (count)'
comment: Day of Month and Daily Visitors (count) — descriptive with units
- id: VQ-07
name: Grid & Legend
score: 2
max: 2
passed: true
comment: Grid is subtle (alpha=0.3, dashed), no legend needed for single series
comment: Grid at alpha 0.3 dashed — subtle and helpful; no legend needed for
single series
spec_compliance:
score: 25
max: 25
Expand All @@ -116,56 +112,57 @@ review:
score: 5
max: 5
passed: true
comment: X is continuous (days), Y is numeric (visitors)
comment: X = continuous days, Y = numeric visitor magnitude
- id: SC-03
name: Required Features
score: 5
max: 5
passed: true
comment: Semi-transparent fill, gridlines, clear axis labels with units, gradient
fill — all spec features present
fill from bottom to line
- id: SC-04
name: Data Range
score: 3
max: 3
passed: true
comment: All data visible within axis limits
comment: Y-axis starts at 0, x-axis spans full 1-30 range
- id: SC-05
name: Legend Accuracy
score: 2
max: 2
passed: true
comment: Single series, no legend needed — appropriate
comment: No legend needed for single-series area chart
- id: SC-06
name: Title Format
score: 2
max: 2
passed: true
comment: Exactly matches area-basic · matplotlib · pyplots.ai
comment: Website Traffic · area-basic · matplotlib · pyplots.ai matches required
format
data_quality:
score: 19
score: 20
max: 20
items:
- id: DQ-01
name: Feature Coverage
score: 7
score: 8
max: 8
passed: true
comment: Shows upward trend and periodic weekend dips; could benefit from
one more feature like a sudden spike
comment: Shows upward trend, weekend dips, noise, and viral spike — demonstrates
area chart strengths
- id: DQ-02
name: Realistic Context
score: 7
max: 7
passed: true
comment: Website daily visitors — realistic neutral scenario matching spec
example
comment: Website traffic is a perfect neutral real-world scenario matching
the spec example
- id: DQ-03
name: Appropriate Scale
score: 5
max: 5
passed: true
comment: Values of 4000-7500 daily visitors are entirely realistic for a website
comment: 2000-8200 daily visitors with weekend dips is highly realistic
code_quality:
score: 10
max: 10
Expand All @@ -175,40 +172,40 @@ review:
score: 3
max: 3
passed: true
comment: 'Clean linear flow: importsdataplotsave'
comment: Clean imports, data, plot, save flow with no functions/classes
- id: CQ-02
name: Reproducibility
score: 3
max: 3
passed: true
comment: Uses np.random.seed(42)
comment: np.random.seed(42) set at the start
- id: CQ-03
name: Clean Imports
score: 2
max: 2
passed: true
comment: All imports are used (mcolors, PathPatch, Path)
comment: All imports used (mcolors, plt, np, PathPatch, Path)
- id: CQ-04
name: No Deprecated API
score: 1
max: 1
passed: true
comment: No deprecated functions used
comment: No deprecated functions
- id: CQ-05
name: Output Correct
score: 1
max: 1
passed: true
comment: Saves as plot.png
comment: Saves as plot.png with dpi=300
library_features:
score: 4
score: 5
max: 5
items:
- id: LF-01
name: Distinctive Features
score: 4
score: 5
max: 5
passed: true
comment: Uses imshow with custom clipping path for gradient fill, LinearSegmentedColormap,
and PathPatch — advanced matplotlib capabilities
comment: Excellent use of imshow with PathPatch clipping for gradient fill,
LinearSegmentedColormap, and Path construction
verdict: APPROVED