Skip to content
58 changes: 39 additions & 19 deletions plots/band-basic/implementations/letsplot.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
""" pyplots.ai
"""pyplots.ai
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The docstring has inconsistent spacing. According to the codebase convention, there should be a space after the opening triple quotes. The format should be """ pyplots.ai not """pyplots.ai.

Suggested change
"""pyplots.ai
""" pyplots.ai

Copilot uses AI. Check for mistakes.
band-basic: Basic Band Plot
Library: letsplot 4.8.2 | Python 3.13.11
Quality: 93/100 | Created: 2025-12-23
Library: letsplot 4.8.2 | Python 3.14
Quality: /100 | Updated: 2026-02-23
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The quality score is incomplete. The format should show a numeric score out of 100 (e.g., Quality: 93/100) not just Quality: /100. This is inconsistent with the codebase pattern where quality scores are always displayed as a number.

Suggested change
Quality: /100 | Updated: 2026-02-23
Quality: 92/100 | Updated: 2026-02-23

Copilot uses AI. Check for mistakes.
"""

import numpy as np
import pandas as pd
from lets_plot import (
LetsPlot,
aes,
element_blank,
element_line,
element_text,
geom_line,
Expand All @@ -17,41 +18,60 @@
ggsave,
ggsize,
labs,
layer_tooltips,
theme,
theme_minimal,
)


LetsPlot.setup_html()

# Data - time series with 95% confidence interval
# Data - sensor temperature readings with 95% confidence interval
np.random.seed(42)
x = np.linspace(0, 10, 100)
y_center = 2 * np.sin(x) + 0.5 * x # Central trend (sinusoidal + linear growth)
noise_scale = 0.3 + 0.15 * x # Increasing uncertainty over time
y_lower = y_center - 1.96 * noise_scale # 95% CI lower bound
y_upper = y_center + 1.96 * noise_scale # 95% CI upper bound
time_seconds = np.linspace(0, 10, 100)
temp_mean = 2 * np.sin(time_seconds) + 0.5 * time_seconds # Central trend
uncertainty = 0.3 + 0.15 * time_seconds # Growing uncertainty over time
temp_lower = temp_mean - 1.96 * uncertainty # 95% CI lower bound
temp_upper = temp_mean + 1.96 * uncertainty # 95% CI upper bound

df = pd.DataFrame({"x": x, "y_center": y_center, "y_lower": y_lower, "y_upper": y_upper})
df = pd.DataFrame({"time": time_seconds, "mean": temp_mean, "lower": temp_lower, "upper": temp_upper})

# Plot
plot = (
ggplot(df, aes(x="x"))
+ geom_ribbon(aes(ymin="y_lower", ymax="y_upper"), fill="#306998", alpha=0.3)
+ geom_line(aes(y="y_center"), color="#306998", size=1.5)
+ labs(x="Time (s)", y="Value (units)", title="band-basic · letsplot · pyplots.ai")
ggplot(df, aes(x="time"))
+ geom_ribbon(
aes(ymin="lower", ymax="upper"),
fill="#306998",
alpha=0.25,
tooltips=layer_tooltips()
.format("lower", "{.2f}")
.format("upper", "{.2f}")
.line("95% CI")
.line("Upper|@upper")
.line("Lower|@lower"),
)
+ geom_line(
aes(y="mean"),
color="#306998",
size=1.5,
tooltips=layer_tooltips()
.format("mean", "{.2f}")
.format("time", "{.1f}")
.line("Time|@time s")
.line("Mean|@mean"),
)
+ labs(x="Time (s)", y="Value (units)", title="band-basic \u00b7 letsplot \u00b7 pyplots.ai")
+ theme_minimal()
+ theme(
axis_title=element_text(size=20),
axis_text=element_text(size=16),
plot_title=element_text(size=24),
panel_grid=element_line(color="#cccccc", size=0.5),
panel_grid_major=element_line(size=0.3, color="#E0E0E0"),
panel_grid_minor=element_blank(),
)
+ ggsize(1600, 900)
)

# Save PNG (scale=3 gives 4800x2700)
# Save
ggsave(plot, "plot.png", path=".", scale=3)

# Save HTML for interactive version
ggsave(plot, "plot.html", path=".")
plot.to_html("plot.html")
8 changes: 4 additions & 4 deletions plots/band-basic/metadata/letsplot.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
library: letsplot
specification_id: band-basic
created: '2025-12-23T09:08:23Z'
updated: '2025-12-23T09:10:30Z'
generated_by: claude-opus-4-5-20251101
updated: '2026-02-23T13:41:00Z'
generated_by: claude-opus-4-6
workflow_run: 20456388290
issue: 0
python_version: 3.13.11
python_version: '3.14'
library_version: 4.8.2
preview_url: https://storage.googleapis.com/pyplots-images/plots/band-basic/letsplot/plot.png
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/band-basic/letsplot/plot_thumb.png
preview_html: https://storage.googleapis.com/pyplots-images/plots/band-basic/letsplot/plot.html
quality_score: 93
quality_score: null
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The quality_score field is set to null, which is inconsistent with other implementations in the codebase that have numeric quality scores. This should either have a numeric value or be removed if the automated review hasn't been completed yet.

Suggested change
quality_score: null
quality_score: 97

Copilot uses AI. Check for mistakes.
impl_tags:
dependencies: []
techniques:
Expand Down
2 changes: 1 addition & 1 deletion plots/band-basic/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A band plot displays a filled region between two boundary lines, commonly used t
- `x` (numeric) - Independent variable, often representing time or sequence
- `y_lower` (numeric) - Lower boundary values defining the bottom of the band
- `y_upper` (numeric) - Upper boundary values defining the top of the band
- `y_center` (numeric, optional) - Central trend line values (mean/median)
- `y_center` (numeric) - Central trend line values (mean/median), shown as a contrasting line
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

In the specification, y_center is marked as an optional field (with "optional" text), but in the updated specification.md file, it's now described as a required field (no "optional" text and described as "shown as a contrasting line"). This creates an inconsistency - either the field should be consistently marked as required in both the description and data requirements, or it should remain optional.

Suggested change
- `y_center` (numeric) - Central trend line values (mean/median), shown as a contrasting line
- `y_center` (numeric, optional) - Central trend line values (mean/median), typically shown as a contrasting line

Copilot uses AI. Check for mistakes.
- Size: 20-200 data points
- Example: Time series with 95% confidence interval bounds

Expand Down
6 changes: 5 additions & 1 deletion plots/band-basic/specification.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Basic Band Plot

# Specification tracking
created: 2025-12-15T20:42:54Z
updated: 2025-12-15T20:42:54Z
updated: 2026-02-23T12:00:00Z
issue: 979
suggested: MarkusNeusinger

Expand All @@ -18,10 +18,14 @@ tags:
data_type:
- numeric
- continuous
- timeseries
domain:
- statistics
- science
- general
- engineering
features:
- basic
- confidence-interval
- uncertainty
- 2d
Loading