Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: unaligned multiline text when using math mode #29527

Open
@jnboehm

Description

@jnboehm

Bug summary

When placing some multiline text where one line includes math mode text and the other does not, then the lines aren't perfectly aligned and there is a slight mismatch (see screenshot).

Code for reproduction

frommatplotlibimportpyplotaspltfig,ax=plt.subplots()txt="$k$1|\n1|"ax.text(1,0.5,txt,ha="right",ma="right",transform=ax.transAxes)fig.savefig("/tmp/bla.pdf")fig.savefig("/tmp/bla.png")

Actual outcome

Image

Expected outcome

That the lines are properly aligned as speicified. What I noticed is that when directly comparing the output with and without math mode in the offending line is that the line is actually shifted to the top right a tiny amount.

Additional information

No response

Operating system

Arch linux

Matplotlib Version

3.10.0

Matplotlib Backend

qtagg

Python version

Python 3.13.1

Jupyter version

n/a

Installation

Linux package manager

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp