Skip to content

Reserve canvas room for categorical tick labels [mpl compatibility] - #256

Closed
sselvakumaran wants to merge 3 commits into
agent/fix-pyplot-autoscale-marginsfrom
agent/gallery-canvas-gutters
Closed

Reserve canvas room for categorical tick labels [mpl compatibility]#256
sselvakumaran wants to merge 3 commits into
agent/fix-pyplot-autoscale-marginsfrom
agent/gallery-canvas-gutters

Conversation

@sselvakumaran

Copy link
Copy Markdown
Contributor

What

Reserve enough left canvas space for authored and categorical y-axis tick labels instead of allowing long labels to be clipped by the export boundary.

This is intentionally stacked on #240 because that PR supplies the autoscale/default-margin foundation. I also rendered it together with #248 to verify the reported gallery case. #240 alone does not fix the clipped Question 1Question 6 labels.

Exact gallery comparison

Columns are Matplotlib 3.11 reference / current combined PR heads before this fix / #248 plus this fix.

Horizontal bar chart categorical labels: Matplotlib reference, current before, fixed after

The after image keeps every category label fully inside the canvas. The legend-border spacing is handled separately by #254.

Validation

  • PYTHONPATH=python /Users/srimans/dev/reviz/.venv/bin/python -m pytest tests/pyplot -q
    • 555 passed, 65 skipped
  • focused gutter tests
    • long category labels reserve at least 100 px and export with positive SVG x coordinates
    • short category labels retain the core default gutter
  • exact scoped-gallery render of horizontal_barchart_distribution.py on the Fix line and legend gallery compatibility [mpl compatibility] #248 stack

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 71ef5394-923d-486b-a0d2-3136645e2c9d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/gallery-canvas-gutters

Comment @coderabbitai help to get the list of available commands.

@codspeed-hq

codspeed-hq Bot commented Jul 24, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 102 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing agent/gallery-canvas-gutters (adff265) with agent/fix-pyplot-autoscale-margins (3b3c2ab)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@sselvakumaran sselvakumaran changed the title Reserve canvas room for categorical tick labels Reserve canvas room for categorical tick labels [mpl compatibility] Jul 24, 2026
@sselvakumaran

Copy link
Copy Markdown
Contributor Author

legend is still cut off a bit on the left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant