Skip to content

Commit fa08331

Browse files
feat(matplotlib): implement box-horizontal (#2562)
## Implementation: `box-horizontal` - matplotlib Implements the **matplotlib** version of `box-horizontal`. **File:** `plots/box-horizontal/implementations/matplotlib.py` --- :robot: *[impl-generate workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20593347218)* --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent b5852ad commit fa08331

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
""" pyplots.ai
2+
box-horizontal: Horizontal Box Plot
3+
Library: matplotlib 3.10.8 | Python 3.13.11
4+
Quality: 94/100 | Created: 2025-12-30
5+
"""
6+
7+
import matplotlib.pyplot as plt
8+
import numpy as np
9+
10+
11+
# Data - Response times (ms) by service type
12+
np.random.seed(42)
13+
14+
# Different services with varying response time distributions
15+
services = [
16+
"Authentication Service",
17+
"Database Query",
18+
"File Upload",
19+
"Payment Processing",
20+
"Email Notification",
21+
"Image Processing",
22+
]
23+
24+
# Generate data with different distributions to show variety
25+
data = [
26+
np.random.normal(150, 30, 80), # Auth - tight distribution
27+
np.concatenate([np.random.normal(200, 40, 70), [450, 480, 520]]), # DB - with outliers
28+
np.random.normal(500, 100, 90), # File upload - wider spread
29+
np.random.exponential(180, 85) + 100, # Payment - skewed right
30+
np.random.normal(80, 15, 75), # Email - fast and tight
31+
np.random.uniform(300, 800, 60), # Image - wide uniform spread
32+
]
33+
34+
# Create figure
35+
fig, ax = plt.subplots(figsize=(16, 9))
36+
37+
# Create horizontal box plot
38+
bp = ax.boxplot(
39+
data,
40+
vert=False,
41+
tick_labels=services,
42+
patch_artist=True,
43+
widths=0.6,
44+
flierprops={"marker": "o", "markersize": 8, "markerfacecolor": "#FFD43B", "markeredgecolor": "#306998"},
45+
medianprops={"color": "#FFD43B", "linewidth": 2.5},
46+
whiskerprops={"color": "#306998", "linewidth": 2},
47+
capprops={"color": "#306998", "linewidth": 2},
48+
boxprops={"facecolor": "#306998", "edgecolor": "#306998", "linewidth": 2, "alpha": 0.7},
49+
)
50+
51+
# Labels and styling
52+
ax.set_xlabel("Response Time (ms)", fontsize=20)
53+
ax.set_ylabel("Service Type", fontsize=20)
54+
ax.set_title("box-horizontal · matplotlib · pyplots.ai", fontsize=24)
55+
ax.tick_params(axis="both", labelsize=16)
56+
ax.grid(True, alpha=0.3, linestyle="--", axis="x")
57+
58+
plt.tight_layout()
59+
plt.savefig("plot.png", dpi=300, bbox_inches="tight")
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
library: matplotlib
2+
specification_id: box-horizontal
3+
created: '2025-12-30T09:30:57Z'
4+
updated: '2025-12-30T09:38:46Z'
5+
generated_by: claude-opus-4-5-20251101
6+
workflow_run: 20593347218
7+
issue: 0
8+
python_version: 3.13.11
9+
library_version: 3.10.8
10+
preview_url: https://storage.googleapis.com/pyplots-images/plots/box-horizontal/matplotlib/plot.png
11+
preview_thumb: https://storage.googleapis.com/pyplots-images/plots/box-horizontal/matplotlib/plot_thumb.png
12+
preview_html: null
13+
quality_score: 94
14+
review:
15+
strengths:
16+
- Excellent data variety showcasing different distribution types (tight, wide, skewed,
17+
with outliers)
18+
- Perfect use of horizontal orientation with readable service type labels
19+
- 'Strong color scheme using Python colors (#306998 blue, #FFD43B yellow) that is
20+
colorblind-accessible'
21+
- Comprehensive matplotlib boxplot customization demonstrating library capabilities
22+
- Clean, well-structured code following KISS principles
23+
weaknesses:
24+
- Grid only on x-axis; adding subtle y-axis grid lines could help visually align
25+
categories across the plot

0 commit comments

Comments
 (0)