Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
105 changes: 51 additions & 54 deletions plots/bump-basic/implementations/plotnine.py
Original file line number Diff line number Diff line change
@@ -1,88 +1,85 @@
""" pyplots.ai
"""pyplots.ai
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

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

The docstring format should include a space after the opening triple quotes to match the codebase convention. The vast majority of plot implementations use """ pyplots.ai (with a space) rather than """pyplots.ai (without a space).

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

Copilot uses AI. Check for mistakes.
bump-basic: Basic Bump Chart
Library: plotnine 0.15.2 | Python 3.13.11
Quality: 92/100 | Created: 2025-12-23
Library: plotnine 0.15.3 | Python 3.14.3
Quality: /100 | Updated: 2026-02-22
Copy link

Copilot AI Feb 22, 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 in the docstring header is incomplete. It shows /100 without a value, but the PR description states "Quality self-assessment: 93/100". This should be Quality: 93/100 to match the stated self-assessment.

Suggested change
Quality: /100 | Updated: 2026-02-22
Quality: 93/100 | Updated: 2026-02-22

Copilot uses AI. Check for mistakes.
"""

import pandas as pd
from plotnine import (
aes,
element_blank,
element_line,
element_rect,
element_text,
geom_line,
geom_point,
geom_text,
ggplot,
labs,
scale_color_brewer,
scale_color_manual,
scale_x_continuous,
scale_y_reverse,
theme,
theme_minimal,
)


# Data - Tech company rankings over 6 quarters
data = {
"entity": ["Alpha Corp"] * 6 + ["Beta Inc"] * 6 + ["Gamma Tech"] * 6 + ["Delta Systems"] * 6 + ["Epsilon Labs"] * 6,
"period": ["Q1", "Q2", "Q3", "Q4", "Q5", "Q6"] * 5,
"period_num": [1, 2, 3, 4, 5, 6] * 5,
"rank": [
1,
1,
2,
2,
1,
1, # Alpha Corp - starts strong, slight dip, recovers
2,
3,
1,
1,
2,
3, # Beta Inc - rises to top mid-year, then falls
3,
2,
3,
4,
4,
2, # Gamma Tech - volatile movement
4,
4,
4,
3,
3,
4, # Delta Systems - stable middle performer
5,
5,
5,
5,
5,
5, # Epsilon Labs - consistently last
],
# Data - Streaming platform market share rankings over 8 quarters
platforms = ["StreamVue", "WavePlay", "CloudCast", "PixelFlix", "SonicNet", "EchoTV"]
quarters = ["Q1'24", "Q2'24", "Q3'24", "Q4'24", "Q1'25", "Q2'25", "Q3'25", "Q4'25"]
n_periods = len(quarters)

rankings = {
"StreamVue": [1, 1, 1, 2, 2, 3, 3, 4],
"WavePlay": [2, 3, 3, 1, 1, 1, 1, 1],
"CloudCast": [4, 2, 2, 3, 3, 2, 2, 2],
"PixelFlix": [3, 4, 4, 4, 5, 5, 4, 3],
"SonicNet": [5, 5, 5, 5, 4, 4, 5, 5],
"EchoTV": [6, 6, 6, 6, 6, 6, 6, 6],
}
df = pd.DataFrame(data)

rows = []
for platform, ranks in rankings.items():
for i, rank in enumerate(ranks):
rows.append({"platform": platform, "quarter": quarters[i], "qnum": i + 1, "rank": rank})
df = pd.DataFrame(rows)

# Subset for end labels
df_end = df[df["period_num"] == 6].copy()
df_end = df[df["qnum"] == n_periods].copy()

# Colors - Python Blue first, then colorblind-safe complements
palette = {
"StreamVue": "#306998",
"WavePlay": "#e8963e",
"CloudCast": "#2ca02c",
"PixelFlix": "#d62728",
"SonicNet": "#8c564b",
"EchoTV": "#7f7f7f",
}

# Plot
plot = (
ggplot(df, aes(x="period_num", y="rank", color="entity", group="entity"))
+ geom_line(size=2.5, alpha=0.8)
+ geom_point(size=6)
+ geom_text(aes(label="entity"), data=df_end, nudge_x=0.3, ha="left", size=12)
+ scale_y_reverse(breaks=[1, 2, 3, 4, 5])
+ scale_x_continuous(breaks=[1, 2, 3, 4, 5, 6], labels=["Q1", "Q2", "Q3", "Q4", "Q5", "Q6"], limits=(0.5, 7.5))
+ scale_color_brewer(type="qual", palette="Set2")
+ labs(x="Quarter", y="Rank", title="bump-basic · plotnine · pyplots.ai", color="Company")
ggplot(df, aes(x="qnum", y="rank", color="platform", group="platform"))
+ geom_line(size=2.8, alpha=0.85)
+ geom_point(size=6, stroke=0.8, fill="white")
+ geom_point(size=4)
+ geom_text(aes(label="platform"), data=df_end, nudge_x=0.35, ha="left", size=12, fontstyle="italic")
+ scale_y_reverse(breaks=range(1, len(platforms) + 1))
+ scale_x_continuous(breaks=range(1, n_periods + 1), labels=quarters, limits=(0.5, n_periods + 2))
+ scale_color_manual(values=palette)
+ labs(x="Quarter", y="Market Share Ranking", title="bump-basic · plotnine · pyplots.ai")
+ theme_minimal()
+ theme(
figure_size=(16, 9),
text=element_text(size=14),
axis_title=element_text(size=20),
axis_text=element_text(size=16),
plot_title=element_text(size=24),
legend_text=element_text(size=16),
legend_title=element_text(size=18),
axis_text_x=element_text(rotation=0),
plot_title=element_text(size=24, weight="bold"),
panel_grid_major_x=element_blank(),
panel_grid_minor=element_blank(),
panel_grid_major_y=element_line(alpha=0.2, size=0.5),
panel_background=element_rect(fill="white", color="none"),
legend_position="none",
)
)
Expand Down
10 changes: 5 additions & 5 deletions plots/bump-basic/metadata/plotnine.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
library: plotnine
specification_id: bump-basic
created: '2025-12-23T09:18:24Z'
updated: '2025-12-23T09:21:54Z'
generated_by: claude-opus-4-5-20251101
updated: '2026-02-22T20:55:00+00:00'
generated_by: claude-opus-4-6
workflow_run: 20456610470
issue: 0
python_version: 3.13.11
library_version: 0.15.2
python_version: '3.14.3'
library_version: '0.15.3'
preview_url: https://storage.googleapis.com/pyplots-images/plots/bump-basic/plotnine/plot.png
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/bump-basic/plotnine/plot_thumb.png
preview_html: null
quality_score: 92
quality_score: null
Copy link

Copilot AI Feb 22, 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 in the metadata YAML, which is inconsistent with the PR description stating "Quality self-assessment: 93/100". Consider updating this field to reflect the stated quality score.

Suggested change
quality_score: null
quality_score: 93

Copilot uses AI. Check for mistakes.
impl_tags:
dependencies: []
techniques:
Expand Down
1 change: 1 addition & 0 deletions plots/bump-basic/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ A bump chart visualizes how rankings change over time by plotting rank positions
- `period` (categorical or time) - Time points for ranking snapshots
- `rank` (integer) - Position at each period (1 = highest rank)
- Size: 5-10 entities, 4-8 periods typical
- Example: Formula 1 driver standings over a 10-race season

## Notes

Expand Down
4 changes: 3 additions & 1 deletion plots/bump-basic/specification.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Basic Bump Chart

# Specification tracking
created: 2025-12-15T20:42:43Z
updated: 2025-12-15T20:42:43Z
updated: 2026-02-22T12:00:00Z
issue: 982
suggested: MarkusNeusinger

Expand All @@ -18,9 +18,11 @@ tags:
data_type:
- categorical
- ordinal
- timeseries
domain:
- general
features:
- basic
- ranking
- temporal
- comparison
Loading