Skip to content

ps: Fix anchoring of rotated usetex text #25784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,10 @@ def draw_tex(self, gc, x, y, s, prop, angle, *, mtext=None):
s = fontcmd % s
tex = r'\color[rgb]{%s} %s' % (color, s)

# Stick to the bottom alignment.
pos = _nums_to_str(x, y-bl)
# Stick to bottom-left alignment, so subtract descent from the text-normal
# direction since text is normally positioned by its baseline.
rangle = np.radians(angle + 90)
pos = _nums_to_str(x - bl * np.cos(rangle), y - bl * np.sin(rangle))
self.psfrag.append(
r'\psfrag{%s}[bl][bl][1][%f]{\fontsize{%f}{%f}%s}' % (
thetext, angle, fontsize, fontsize*1.25, tex))
Expand Down
Loading