Match Matplotlib gallery text fidelity [mpl compatibility]#255
Match Matplotlib gallery text fidelity [mpl compatibility]#255sselvakumaran wants to merge 3 commits into
Conversation
📝 WalkthroughWalkthroughChart text styling now propagates through pyplot, chart styles, SVG, raster, and DOM renderers. Mathtext conversion reports italic ranges and supports more commands. Native font data adds ö and ü coverage with updated generation, documentation, and tests. ChangesText rendering updates
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Axes
participant Chart
participant SVG
participant Raster
Axes->>Chart: pass title and axis styles
Chart->>SVG: render styled text
Chart->>Raster: render styled text
SVG-->>Axes: return SVG output
Raster-->>Axes: return raster output
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review Visual proof for the exact official Matplotlib 3.11 The follow-up restores the missing |
|
The Comment image shows a three-column The PR description image shows the analogous
✅ Action performedReview finished.
|
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@spec/design/rust-engine.md`:
- Around line 130-136: Update the earlier font.rs description to report 207
glyph records and 112 non-ASCII codepoints, matching the §2 module-boundary
counts and current font::EXTRA_CODEPOINTS contents. If the referenced font.rs
line count has changed, update the “font.rs (1039)” figure as well; modify only
the stale specification references.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c781469f-ff49-41db-9730-ed566ecbf587
📒 Files selected for processing (12)
js/src/50_chartview.tspython/xy/_raster.pypython/xy/_svg.pypython/xy/pyplot/_axes.pypython/xy/pyplot/_mathtext.pypython/xy/styles.pyscripts/gen_font.pyspec/api/styling.mdspec/design/rust-engine.mdsrc/font.rssrc/raster.rstests/pyplot/test_gallery_text_pie_compat.py
| Unicode coverage. `font.rs` bakes exactly 207 glyphs: ASCII 32–126 (95) plus | ||
| the 112 codepoints enumerated in `font::EXTRA_CODEPOINTS` — lowercase Greek | ||
| (α–ω) and the eleven uppercase Greek letters that differ from Latin forms | ||
| (Γ Δ Θ Λ Ξ Π Σ Υ Φ Ψ Ω), math operators (`∂ ∇ ∈ − ∓ √ ∝ ∞ ∫ ≈ ≠ ≤ ≥`), the | ||
| left and right arrows only, super/subscript digits and a handful of subscript | ||
| letters, typographic quotes, en/em dashes, and a few symbols (`° ± × · µ ²³¹ …`). | ||
| Nothing else exists: no accented Latin at all, no Cyrillic, no CJK, no Arabic, | ||
| letters, typographic quotes, en/em dashes, the `ö`/`ü` glyphs used by | ||
| Matplotlib's canonical text example, and a few symbols (`° ± × · µ ²³¹ …`). |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Sync the stale glyph counts in §2 module boundaries. This section now correctly says 207 glyphs / 112 codepoints, but the font.rs description earlier in the same file still reads "205 glyph records" and "the 110 non-ASCII codepoints" — now inconsistent with font.rs and this section. Update those two figures (and the font.rs (1039) line count if it also moved) so the spec stays current.
As per path instructions: "keep the entire spec/ directory current with relevant code, configuration, build, and release changes."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@spec/design/rust-engine.md` around lines 130 - 136, Update the earlier
font.rs description to report 207 glyph records and 112 non-ASCII codepoints,
matching the §2 module-boundary counts and current font::EXTRA_CODEPOINTS
contents. If the referenced font.rs line count has changed, update the “font.rs
(1039)” figure as well; modify only the stale specification references.
Source: Path instructions
|
this should probably also allow bold, etc. to the subtitle. (might be fixed in another PR) |

Summary
This follow-up is stacked on #243 and fixes the remaining text fidelity gaps in two official Matplotlib 3.11 gallery examples:
fontdictfamily, color, weight, style, and size for axes titles and labels across browser, SVG, and native PNG paths\cos,\exp, etc.) to upright readable text while preserving italic variables, Unicode π, and the Matplotlib minus signöandüglyphs used bytext_commands.pyto the bounded native atlas, without changing unrelated historical advancesExact gallery comparisons
text_commands.pyMatplotlib 3.11 reference → #243 tip → this follow-up. The detail crop makes the restored
für Festkörperphysikglyphs visible.text_fontdict.pyMatplotlib 3.11 reference → #243 tip → this follow-up. The follow-up restores the dark-red 16 pt title/axis styling and renders
cos(2πt)exp(−t)instead of leaking TeX commands.Verification
pnpm run typecheckpnpm run buildtext_commands.pyremains automatically classified as similarDraft because this intentionally depends on #243; it should be rebased/retargeted after that PR lands.
Summary by CodeRabbit
New Features
öandücharacters in raster and SVG output.Bug Fixes
Documentation