Skip to content

Commit ce3f0d4

Browse files
feat(seaborn): implement line-stepwise (#2848)
## Implementation: `line-stepwise` - seaborn Implements the **seaborn** version of `line-stepwise`. **File:** `plots/line-stepwise/implementations/seaborn.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20606633234)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 6944797 commit ce3f0d4

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
""" pyplots.ai
2+
line-stepwise: Step Line Plot
3+
Library: seaborn 0.13.2 | Python 3.13.11
4+
Quality: 92/100 | Created: 2025-12-30
5+
"""
6+
7+
import matplotlib.pyplot as plt
8+
import numpy as np
9+
import seaborn as sns
10+
11+
12+
# Data - Daily server load showing discrete state changes
13+
np.random.seed(42)
14+
hours = np.arange(0, 24)
15+
# Simulate server load with discrete jumps at certain hours
16+
base_load = np.array([20, 20, 15, 15, 15, 25, 40, 65, 80, 85, 85, 75, 70, 75, 80, 85, 90, 85, 70, 55, 45, 35, 30, 25])
17+
load_noise = np.random.randint(-3, 4, size=24)
18+
server_load = np.clip(base_load + load_noise, 10, 100)
19+
20+
# Create figure
21+
fig, ax = plt.subplots(figsize=(16, 9))
22+
sns.set_style("whitegrid")
23+
24+
# Step line plot using seaborn lineplot with drawstyle
25+
# seaborn's lineplot wraps matplotlib, so we use drawstyle for step effect
26+
sns.lineplot(x=hours, y=server_load, ax=ax, drawstyle="steps-post", linewidth=3, color="#306998")
27+
28+
# Add markers at each data point for clarity
29+
sns.scatterplot(x=hours, y=server_load, ax=ax, s=150, color="#FFD43B", edgecolor="#306998", linewidth=2, zorder=5)
30+
31+
# Styling
32+
ax.set_xlabel("Hour of Day", fontsize=20)
33+
ax.set_ylabel("Server Load (%)", fontsize=20)
34+
ax.set_title("line-stepwise · seaborn · pyplots.ai", fontsize=24)
35+
ax.tick_params(axis="both", labelsize=16)
36+
37+
# Set axis limits
38+
ax.set_xlim(-0.5, 23.5)
39+
ax.set_ylim(0, 105)
40+
41+
# Customize grid
42+
ax.grid(True, alpha=0.3, linestyle="--")
43+
44+
# Set x-ticks to show every 2 hours
45+
ax.set_xticks(np.arange(0, 24, 2))
46+
47+
plt.tight_layout()
48+
plt.savefig("plot.png", dpi=300, bbox_inches="tight")
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
library: seaborn
2+
specification_id: line-stepwise
3+
created: '2025-12-30T21:51:58Z'
4+
updated: '2025-12-30T21:54:12Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20606633234
7+
issue: 0
8+
python_version: 3.13.11
9+
library_version: 0.13.2
10+
preview_url: https://storage.googleapis.com/pyplots-images/plots/line-stepwise/seaborn/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/line-stepwise/seaborn/plot_thumb.png
12+
preview_html: null
13+
quality_score: 92
14+
review:
15+
strengths:
16+
- Excellent visualization of step function with clear horizontal and vertical transitions
17+
- Realistic server load scenario that demonstrates the plot type well
18+
- Perfect text sizing and legibility at target resolution
19+
- Good use of markers to highlight actual data points on the step line
20+
- Clean color scheme (Python blue/yellow) with good colorblind accessibility
21+
- Proper title format following spec-id · library · pyplots.ai convention
22+
weaknesses:
23+
- sns.set_style("whitegrid") is called after figure creation, which may not apply
24+
the style correctly (should be called before plt.subplots)
25+
- Limited use of seaborn-specific features - the implementation relies heavily on
26+
matplotlib drawstyle parameter passed through seaborn

0 commit comments

Comments
 (0)