From 40e485a8ad4016a9c37e7ba0028400dcf7911ee7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Dec 2025 16:29:54 +0000 Subject: [PATCH 1/5] feat(plotly): implement facet-grid --- plots/facet-grid/implementations/plotly.py | 90 ++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 plots/facet-grid/implementations/plotly.py diff --git a/plots/facet-grid/implementations/plotly.py b/plots/facet-grid/implementations/plotly.py new file mode 100644 index 0000000000..205ff91268 --- /dev/null +++ b/plots/facet-grid/implementations/plotly.py @@ -0,0 +1,90 @@ +"""pyplots.ai +facet-grid: Faceted Grid Plot +Library: plotly | Python 3.13 +Quality: pending | Created: 2025-12-30 +""" + +import numpy as np +import pandas as pd +import plotly.express as px + + +# Data - Create realistic dataset for faceted visualization +np.random.seed(42) + +# Product performance data across regions and quarters +regions = ["North", "South", "East", "West"] +quarters = ["Q1", "Q2", "Q3", "Q4"] + +data = [] +for region in regions: + for quarter in quarters: + # Generate 15 data points per region-quarter combination + n = 15 + # Base values vary by region and quarter + base_sales = {"North": 80, "South": 60, "East": 70, "West": 75} + quarter_effect = {"Q1": 0, "Q2": 10, "Q3": 5, "Q4": 15} + + marketing_spend = np.random.uniform(10, 50, n) + sales = ( + base_sales[region] + + quarter_effect[quarter] + + marketing_spend * (0.8 + np.random.uniform(0, 0.4, n)) + + np.random.normal(0, 5, n) + ) + + for i in range(n): + data.append( + { + "Marketing Spend ($K)": marketing_spend[i], + "Sales ($K)": sales[i], + "Region": region, + "Quarter": quarter, + } + ) + +df = pd.DataFrame(data) + +# Create faceted scatter plot +fig = px.scatter( + df, + x="Marketing Spend ($K)", + y="Sales ($K)", + facet_row="Region", + facet_col="Quarter", + color="Region", + color_discrete_sequence=["#306998", "#FFD43B", "#4B8BBE", "#FFE873"], +) + +# Update layout for large canvas +fig.update_layout( + title=dict(text="facet-grid · plotly · pyplots.ai", font=dict(size=32), x=0.5, xanchor="center"), + font=dict(size=16), + template="plotly_white", + showlegend=True, + legend=dict( + title=dict(text="Region", font=dict(size=20)), + font=dict(size=18), + orientation="v", + yanchor="top", + y=0.98, + xanchor="left", + x=1.02, + ), + margin=dict(l=80, r=150, t=100, b=80), +) + +# Update axes for all facets +fig.update_xaxes(title_font=dict(size=20), tickfont=dict(size=16), gridcolor="rgba(0,0,0,0.1)", gridwidth=1) + +fig.update_yaxes(title_font=dict(size=20), tickfont=dict(size=16), gridcolor="rgba(0,0,0,0.1)", gridwidth=1) + +# Update facet labels (annotations) +fig.for_each_annotation(lambda a: a.update(font=dict(size=18))) + +# Update markers for visibility +fig.update_traces(marker=dict(size=12, opacity=0.8, line=dict(width=1, color="white"))) + +# Save as PNG and HTML +fig.write_image("plot.png", width=1600, height=900, scale=3) +fig.write_html("plot.html", include_plotlyjs="cdn") From c4c10103db48268ec03769aa74b7ab842170f8e7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Dec 2025 16:30:15 +0000 Subject: [PATCH 2/5] chore(plotly): add metadata for facet-grid --- plots/facet-grid/metadata/plotly.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plots/facet-grid/metadata/plotly.yaml diff --git a/plots/facet-grid/metadata/plotly.yaml b/plots/facet-grid/metadata/plotly.yaml new file mode 100644 index 0000000000..df1e8cb5f0 --- /dev/null +++ b/plots/facet-grid/metadata/plotly.yaml @@ -0,0 +1,19 @@ +# Per-library metadata for plotly implementation of facet-grid +# Auto-generated by impl-generate.yml + +library: plotly +specification_id: facet-grid +created: '2025-12-30T16:30:15Z' +updated: '2025-12-30T16:30:15Z' +generated_by: claude-opus-4-5-20251101 +workflow_run: 20601057130 +issue: 0 +python_version: 3.13.11 +library_version: 6.5.0 +preview_url: https://storage.googleapis.com/pyplots-images/plots/facet-grid/plotly/plot.png +preview_thumb: https://storage.googleapis.com/pyplots-images/plots/facet-grid/plotly/plot_thumb.png +preview_html: https://storage.googleapis.com/pyplots-images/plots/facet-grid/plotly/plot.html +quality_score: null +review: + strengths: [] + weaknesses: [] From 4dc6fc41e84e67ea7c5f39b792d683d3e0e75f2d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Dec 2025 16:38:40 +0000 Subject: [PATCH 3/5] chore(plotly): update quality score 85 and review feedback for facet-grid --- plots/facet-grid/implementations/plotly.py | 6 +++--- plots/facet-grid/metadata/plotly.yaml | 25 ++++++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/plots/facet-grid/implementations/plotly.py b/plots/facet-grid/implementations/plotly.py index 205ff91268..f4a8d371c1 100644 --- a/plots/facet-grid/implementations/plotly.py +++ b/plots/facet-grid/implementations/plotly.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai facet-grid: Faceted Grid Plot -Library: plotly | Python 3.13 -Quality: pending | Created: 2025-12-30 +Library: plotly 6.5.0 | Python 3.13.11 +Quality: 85/100 | Created: 2025-12-30 """ import numpy as np diff --git a/plots/facet-grid/metadata/plotly.yaml b/plots/facet-grid/metadata/plotly.yaml index df1e8cb5f0..02bb61bfba 100644 --- a/plots/facet-grid/metadata/plotly.yaml +++ b/plots/facet-grid/metadata/plotly.yaml @@ -1,10 +1,7 @@ -# Per-library metadata for plotly implementation of facet-grid -# Auto-generated by impl-generate.yml - library: plotly specification_id: facet-grid created: '2025-12-30T16:30:15Z' -updated: '2025-12-30T16:30:15Z' +updated: '2025-12-30T16:38:39Z' generated_by: claude-opus-4-5-20251101 workflow_run: 20601057130 issue: 0 @@ -13,7 +10,21 @@ library_version: 6.5.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/facet-grid/plotly/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/facet-grid/plotly/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/facet-grid/plotly/plot.html -quality_score: null +quality_score: 85 review: - strengths: [] - weaknesses: [] + strengths: + - Excellent faceted grid layout with clear row (Region) and column (Quarter) organization + - Good use of px.scatter built-in faceting capabilities with facet_row and facet_col + - Realistic business scenario with marketing spend vs sales data showing positive + correlation + - Clean readable code following KISS principles + - Appropriate marker sizing and opacity for the data density + - Proper title format following pyplots.ai convention + weaknesses: + - 'Redundant color encoding: Region is already encoded by facet rows, so using color=Region + adds no information and creates visual confusion' + - Should use color to encode an additional dimension or remove color differentiation + entirely + - Legend shows Region which is redundant with row labels + - Only 2 visually distinct colors (blue and yellow) for 4 regions makes differentiation + within color groups impossible From ca5cde9c29debbd5802b82a88abbdd909734391c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Dec 2025 16:43:46 +0000 Subject: [PATCH 4/5] fix(plotly): address review feedback for facet-grid - Remove redundant color encoding by Region (already encoded by facet rows) - Remove legend since no color differentiation needed - Use single consistent color (#306998) for all markers Attempt 1/3 - fixes based on AI review --- plots/facet-grid/implementations/plotly.py | 30 +++++----------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/plots/facet-grid/implementations/plotly.py b/plots/facet-grid/implementations/plotly.py index f4a8d371c1..0d443d0bdc 100644 --- a/plots/facet-grid/implementations/plotly.py +++ b/plots/facet-grid/implementations/plotly.py @@ -1,4 +1,4 @@ -""" pyplots.ai +"""pyplots.ai facet-grid: Faceted Grid Plot Library: plotly 6.5.0 | Python 3.13.11 Quality: 85/100 | Created: 2025-12-30 @@ -46,32 +46,16 @@ df = pd.DataFrame(data) # Create faceted scatter plot -fig = px.scatter( - df, - x="Marketing Spend ($K)", - y="Sales ($K)", - facet_row="Region", - facet_col="Quarter", - color="Region", - color_discrete_sequence=["#306998", "#FFD43B", "#4B8BBE", "#FFE873"], -) +# Using single color since Region is already encoded by facet rows +fig = px.scatter(df, x="Marketing Spend ($K)", y="Sales ($K)", facet_row="Region", facet_col="Quarter") # Update layout for large canvas fig.update_layout( title=dict(text="facet-grid · plotly · pyplots.ai", font=dict(size=32), x=0.5, xanchor="center"), font=dict(size=16), template="plotly_white", - showlegend=True, - legend=dict( - title=dict(text="Region", font=dict(size=20)), - font=dict(size=18), - orientation="v", - yanchor="top", - y=0.98, - xanchor="left", - x=1.02, - ), - margin=dict(l=80, r=150, t=100, b=80), + showlegend=False, + margin=dict(l=80, r=80, t=100, b=80), ) # Update axes for all facets @@ -82,8 +66,8 @@ # Update facet labels (annotations) fig.for_each_annotation(lambda a: a.update(font=dict(size=18))) -# Update markers for visibility -fig.update_traces(marker=dict(size=12, opacity=0.8, line=dict(width=1, color="white"))) +# Update markers with consistent color for visibility +fig.update_traces(marker=dict(size=12, opacity=0.8, color="#306998", line=dict(width=1, color="white"))) # Save as PNG and HTML fig.write_image("plot.png", width=1600, height=900, scale=3) From 9ec14e0da4befa36882f1c84b08f16916e2cf856 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Dec 2025 16:47:28 +0000 Subject: [PATCH 5/5] chore(plotly): update quality score 91 and review feedback for facet-grid --- plots/facet-grid/implementations/plotly.py | 4 +-- plots/facet-grid/metadata/plotly.yaml | 31 +++++++++++----------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/plots/facet-grid/implementations/plotly.py b/plots/facet-grid/implementations/plotly.py index 0d443d0bdc..db1386b9fe 100644 --- a/plots/facet-grid/implementations/plotly.py +++ b/plots/facet-grid/implementations/plotly.py @@ -1,7 +1,7 @@ -"""pyplots.ai +""" pyplots.ai facet-grid: Faceted Grid Plot Library: plotly 6.5.0 | Python 3.13.11 -Quality: 85/100 | Created: 2025-12-30 +Quality: 91/100 | Created: 2025-12-30 """ import numpy as np diff --git a/plots/facet-grid/metadata/plotly.yaml b/plots/facet-grid/metadata/plotly.yaml index 02bb61bfba..7a6a4cb0cf 100644 --- a/plots/facet-grid/metadata/plotly.yaml +++ b/plots/facet-grid/metadata/plotly.yaml @@ -1,7 +1,7 @@ library: plotly specification_id: facet-grid created: '2025-12-30T16:30:15Z' -updated: '2025-12-30T16:38:39Z' +updated: '2025-12-30T16:47:28Z' generated_by: claude-opus-4-5-20251101 workflow_run: 20601057130 issue: 0 @@ -10,21 +10,20 @@ library_version: 6.5.0 preview_url: https://storage.googleapis.com/pyplots-images/plots/facet-grid/plotly/plot.png preview_thumb: https://storage.googleapis.com/pyplots-images/plots/facet-grid/plotly/plot_thumb.png preview_html: https://storage.googleapis.com/pyplots-images/plots/facet-grid/plotly/plot.html -quality_score: 85 +quality_score: 91 review: strengths: - - Excellent faceted grid layout with clear row (Region) and column (Quarter) organization - - Good use of px.scatter built-in faceting capabilities with facet_row and facet_col - - Realistic business scenario with marketing spend vs sales data showing positive - correlation - - Clean readable code following KISS principles - - Appropriate marker sizing and opacity for the data density - - Proper title format following pyplots.ai convention + - Clean implementation using Plotly Express native faceting capability (facet_row, + facet_col) + - Excellent data generation with realistic business scenario (marketing spend vs + sales by region and quarter) + - Good visual hierarchy with clear title, readable axis labels with units, and subtle + grid + - Produces both PNG and HTML output leveraging Plotly interactivity + - Proper use of template=plotly_white for clean appearance weaknesses: - - 'Redundant color encoding: Region is already encoded by facet rows, so using color=Region - adds no information and creates visual confusion' - - Should use color to encode an additional dimension or remove color differentiation - entirely - - Legend shows Region which is redundant with row labels - - Only 2 visually distinct colors (blue and yellow) for 4 regions makes differentiation - within color groups impossible + - Legend showing regions is redundant since region is already encoded by facet rows + - Markers could be slightly larger (15-18 instead of 12) for better visibility with + ~15 points per facet + - Row facet labels are displayed vertically which reduces readability compared to + horizontal text