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
57 changes: 57 additions & 0 deletions plots/line-stepwise/implementations/letsplot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
""" pyplots.ai
line-stepwise: Step Line Plot
Library: letsplot 4.8.2 | Python 3.13.11
Quality: 92/100 | Created: 2025-12-30
"""

import numpy as np
import pandas as pd
from lets_plot import * # noqa: F403, F401


LetsPlot.setup_html()

# Data - Server Response Time Monitor (discrete state changes)
np.random.seed(42)
hours = np.arange(0, 24)

# Response time that changes in steps (server performance states)
base_response = 50
response_times = [base_response]

for i in range(1, 24):
# Random step changes at certain hours
if i in [6, 9, 12, 15, 18, 21]:
change = np.random.choice([-20, -10, 10, 20, 30])
new_val = max(20, min(150, response_times[-1] + change))
response_times.append(new_val)
else:
response_times.append(response_times[-1])

response_times = np.array(response_times)

df = pd.DataFrame({"hour": hours, "response_time": response_times})

# Plot
plot = (
ggplot(df, aes(x="hour", y="response_time"))
+ geom_step(color="#306998", size=2, direction="hv")
+ geom_point(color="#FFD43B", size=5, shape=21, fill="#FFD43B", stroke=1.5)
+ labs(x="Hour of Day", y="Response Time (ms)", title="line-stepwise · letsplot · pyplots.ai")
+ scale_x_continuous(breaks=list(range(0, 25, 3)))
+ theme_minimal()
+ theme(
plot_title=element_text(size=24, face="bold"),
axis_title=element_text(size=20),
axis_text=element_text(size=16),
panel_grid_major=element_line(color="#CCCCCC", size=0.5),
panel_grid_minor=element_blank(),
)
+ ggsize(1600, 900)
)

# Save PNG (scale 3x for 4800 x 2700 px)
ggsave(plot, "plot.png", scale=3)

# Save HTML for interactive version
ggsave(plot, "plot.html")
29 changes: 29 additions & 0 deletions plots/line-stepwise/metadata/letsplot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
library: letsplot
specification_id: line-stepwise
created: '2025-12-30T10:43:40Z'
updated: '2025-12-30T10:51:52Z'
generated_by: claude-opus-4-5-20251101
workflow_run: 20594566810
issue: 0
python_version: 3.13.11
library_version: 4.8.2
preview_url: https://storage.googleapis.com/pyplots-images/plots/line-stepwise/letsplot/plot.png
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-stepwise/letsplot/plot_thumb.png
preview_html: https://storage.googleapis.com/pyplots-images/plots/line-stepwise/letsplot/plot.html
quality_score: 92
review:
strengths:
- Excellent step line visualization with clear horizontal-then-vertical transitions
using direction=hv
- Points overlay on steps helps identify exact data points at each hour
- Good color scheme with Python-inspired blue and yellow that is colorblind accessible
- Realistic server response time monitoring scenario that demonstrates discrete
state changes
- Proper title format following spec-id · library · pyplots.ai convention
- Clean KISS code structure with reproducible random seed
- Both PNG and HTML outputs generated correctly
weaknesses:
- Grid line color could be slightly more subtle
- Points at every hour are slightly redundant - could highlight only the change
points
- Data pattern is somewhat predictable with changes only at specific scheduled hours