diff --git a/plots/box-horizontal/implementations/matplotlib.py b/plots/box-horizontal/implementations/matplotlib.py new file mode 100644 index 0000000000..6219fb39ea --- /dev/null +++ b/plots/box-horizontal/implementations/matplotlib.py @@ -0,0 +1,59 @@ +""" pyplots.ai +box-horizontal: Horizontal Box Plot +Library: matplotlib 3.10.8 | Python 3.13.11 +Quality: 94/100 | Created: 2025-12-30 +""" + +import matplotlib.pyplot as plt +import numpy as np + + +# Data - Response times (ms) by service type +np.random.seed(42) + +# Different services with varying response time distributions +services = [ + "Authentication Service", + "Database Query", + "File Upload", + "Payment Processing", + "Email Notification", + "Image Processing", +] + +# Generate data with different distributions to show variety +data = [ + np.random.normal(150, 30, 80), # Auth - tight distribution + np.concatenate([np.random.normal(200, 40, 70), [450, 480, 520]]), # DB - with outliers + np.random.normal(500, 100, 90), # File upload - wider spread + np.random.exponential(180, 85) + 100, # Payment - skewed right + np.random.normal(80, 15, 75), # Email - fast and tight + np.random.uniform(300, 800, 60), # Image - wide uniform spread +] + +# Create figure +fig, ax = plt.subplots(figsize=(16, 9)) + +# Create horizontal box plot +bp = ax.boxplot( + data, + vert=False, + tick_labels=services, + patch_artist=True, + widths=0.6, + flierprops={"marker": "o", "markersize": 8, "markerfacecolor": "#FFD43B", "markeredgecolor": "#306998"}, + medianprops={"color": "#FFD43B", "linewidth": 2.5}, + whiskerprops={"color": "#306998", "linewidth": 2}, + capprops={"color": "#306998", "linewidth": 2}, + boxprops={"facecolor": "#306998", "edgecolor": "#306998", "linewidth": 2, "alpha": 0.7}, +) + +# Labels and styling +ax.set_xlabel("Response Time (ms)", fontsize=20) +ax.set_ylabel("Service Type", fontsize=20) +ax.set_title("box-horizontal · matplotlib · pyplots.ai", fontsize=24) +ax.tick_params(axis="both", labelsize=16) +ax.grid(True, alpha=0.3, linestyle="--", axis="x") + +plt.tight_layout() +plt.savefig("plot.png", dpi=300, bbox_inches="tight") diff --git a/plots/box-horizontal/metadata/matplotlib.yaml b/plots/box-horizontal/metadata/matplotlib.yaml new file mode 100644 index 0000000000..4bfc56aab2 --- /dev/null +++ b/plots/box-horizontal/metadata/matplotlib.yaml @@ -0,0 +1,25 @@ +library: matplotlib +specification_id: box-horizontal +created: '2025-12-30T09:30:57Z' +updated: '2025-12-30T09:38:46Z' +generated_by: claude-opus-4-5-20251101 +workflow_run: 20593347218 +issue: 0 +python_version: 3.13.11 +library_version: 3.10.8 +preview_url: https://storage.googleapis.com/pyplots-images/plots/box-horizontal/matplotlib/plot.png +preview_thumb: https://storage.googleapis.com/pyplots-images/plots/box-horizontal/matplotlib/plot_thumb.png +preview_html: null +quality_score: 94 +review: + strengths: + - Excellent data variety showcasing different distribution types (tight, wide, skewed, + with outliers) + - Perfect use of horizontal orientation with readable service type labels + - 'Strong color scheme using Python colors (#306998 blue, #FFD43B yellow) that is + colorblind-accessible' + - Comprehensive matplotlib boxplot customization demonstrating library capabilities + - Clean, well-structured code following KISS principles + weaknesses: + - Grid only on x-axis; adding subtle y-axis grid lines could help visually align + categories across the plot