SVG backend - handle font weight as integer#30960
Merged
story645 merged 6 commits intomatplotlib:mainfrom Jan 14, 2026
Merged
Conversation
story645
added a commit
to story645/starplot
that referenced
this pull request
Jan 13, 2026
Hi, Since you mentioned Starplot in matplotlib/matplotlib#30960, figured you might be interested in identifying the project as an mpl downstream library on PyPI via the trove classifier. Also please consider your very cool library to https://matplotlib.org/thirdpartypackages/
Member
|
Thanks for the PR! What happens if someone passes in a string fontweight (for example they're saving to multiple filetypes)? |
story645
reviewed
Jan 13, 2026
timhoffm
reviewed
Jan 14, 2026
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
timhoffm
approved these changes
Jan 14, 2026
Member
|
Thanks for the bug fix! |
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Jan 14, 2026
timhoffm
added a commit
that referenced
this pull request
Jan 14, 2026
…960-on-v3.10.x Backport PR #30960 on branch v3.10.x (SVG backend - handle font weight as integer)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR summary
This fixes a small bug with handling integer font weights when rendering text in SVGs as elements vs paths (i.e.
plt.rcParams['svg.fonttype'] = 'none').To reproduce:
Raises:
The problem is that the font
weight_dictis keyed on the string values, butget_weightreturns an integer.PR checklist
I couldn't find an open issue for this, but let me know if one exists already. This is also my first PR to matplotlib, so let me know if there's anything I missed in your contribution process. Appreciate any feedback! And, thanks so much for maintaining this library! It's the backbone of Starplot, a sky mapping library I maintain.