Skip to content

Conversation

@gigoiy
Copy link

@gigoiy gigoiy commented Dec 9, 2025

This is a draft PR!!!

  • Confirmed that the backend doesn't path the text as opposed to being cut off via image size -> Fix functionality
  • Update docs for the new feature

PR summary

Why is this change necessary?: This change is necessary so that users have the ability to save text as vector images

What problem does it solve?: The inability to not be able to save text as vector images for the PS backend restricts matplotlib's usage in scientific journals where text being embedded as an image is a requirement

What is the reasoning for this implementation?: A user opened an issue asking for this feature because it was a requirement to submit his/her/their paper to a scientific journal

Changes Made:

  • Implemented functionality to draw text as a path to backend_ps.py using a new rcparam called ps.pathtext
  • Updated rcsetup.py to attach the validate_bool() validator to ps.pathtext
  • Updated matplotlibrc to include ps.pathtext's default value False
  • Updated typing.py to include ps.pathtext
  • Updated backend_ps.py to handle math text properly when calling the new feature and fix recursiveness
  • Updated backend_ps.py to use the proper method name when calling get_size()
  • Passed pre-existing pytests
  • Added generate_pstext.py to help with generating the baseline image
  • Generated the baseline image
  • Added test_pathtext.py to pytest the new feature

Supposed to close Issue #8480

PR checklist

@gigoiy
Copy link
Author

gigoiy commented Dec 10, 2025

@story645 I wanted to verify something real quick: Is the PS backend using 1,000 units per EM?

Nevermind, found the UPM from the afm font files.

rcomer and others added 10 commits December 12, 2025 18:41
previously-committed psuedo-code
Added pytest for new feature, rebased commits

Removed trailing whitespace

Implemented pytest for new feature

Removed whitespace

Fixed coding style

Further fixed coding style

Further fixed coding style. Sigh.

Updated backend_ps.py to call the proper function
to get the font size

Rebased commits to only have one copy of the new base image
Removed trailing whitespace in backend_ps.py

Properly implemented the new feature from
previously-committed psuedo-code

Fixed coding style

Added pytest for new feature, rebased commits
Removed trailing whitespace

Implemented pytest for new feature

Removed whitespace

Fixed coding style

Further fixed coding style

Further fixed coding style. Sigh.

Updated backend_ps.py to call the proper function
to get the font size
@gigoiy
Copy link
Author

gigoiy commented Dec 13, 2025

@rcomer I might need some guidance on how to properly rebase my branch for a new base image. It's honestly my first time utilizing squash or rebase at all for that matter.

@rcomer
Copy link
Member

rcomer commented Dec 13, 2025

Hi @gigoiy we have instructions for interactive rebase here. Definitely make a backup copy of your branch first!

https://matplotlib.org/devdocs/devel/development_workflow.html#rewrite-commit-history

@gigoiy
Copy link
Author

gigoiy commented Dec 13, 2025

@rcomer Definitely already made a backup copy before making this mess lol! I'll continue to tackle this on Monday

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants