Repository navigation
ps: Fix anchoring of rotated usetex text - #25784
Conversation
|
Hmm, locally, I'm already seeing a failure of |
|
Can't reproduce in Ubuntu 22.04 WSL; probably an update to Ghostscript or similar. |
In PostScript, usetex text is anchored to the bottom left for replacement by psfrag, while in Matplotlib, text is placed by the baseline usually. So PostScript subtracts the text depth from the y position, but for rotated text, this subtraction should also be in a rotated direction.
5c52beb to
19355c6
Compare
|
Since we recently moved a CI to Ubuntu 22.04, I rebased this to test against it. As expected above, it does pass on that system. Looking at the result on 20.04, it's a bit unexpected as only the markers on the far right column are missing. |
|
Since Fedora is on Ghostscript 9.56.1 or above, Ubuntu 20.04 is 9.50, and Ubuntu 22.04 is 9.55, I've set an increased tolerance for any version < 9.55. The Ubuntu releases between those don't seem to have available repos, so I don't want to spend too much time investigating further into it. |
PR Summary
In PostScript, usetex text is anchored to the bottom left for replacement by psfrag, while in Matplotlib, text is placed by the baseline usually. So PostScript subtracts the text depth from the y position, but for rotated text, this subtraction should also be in a rotated direction.
I added test images for all 4 formats (eps + defaults) which might be a bit overkill, but as this problem would only manifest when you looked at the result, it was the only way to check. And while I did add markers for checking the alignment, I really just compared
.epswith.pdfor.pngas those appeared to be correct already.Fixes #9158
PR Checklist
Linked Issue
Documentation and Tests
pytestpasses)Release Notes
.. versionadded::directive in the docstring and documented indoc/users/next_whats_new/.. versionchanged::directive in the docstring and documented indoc/api/next_api_changes/next_whats_new/README.rstornext_api_changes/README.rst