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]: Pgf backend places top ticks labels incorrectly #27974

Open
@IjhUDWzf

Description

@IjhUDWzf

Bug summary

Whenpgf is used for saving figure and ticks labels above the figure are used apgf code like\pgftext[x=1in,y=1in,,bottom]{\(\displaystyle {\ensuremath{-}3}\)}% is produced. This places numbers withminus at differenty coordinate (higher) than numbers without it. By usingbase as alignment instead ofbottom the issue seems to be resolved. I originally thought that it is a bug inpgf which does not seem to be thecase. Moreover, the default placement of the labels on the right side could be improved by alignment at decimal point.

Code for reproduction

importmatplotlibimportmatplotlib.pyplotaspltimportnumpyasnpmatplotlib.use('pgf')matplotlib.rcParams.update({'text.usetex'     :True,'pgf.texsystem'   :'pdflatex',})fig,ax=plt.subplots(figsize=(4,3))ax.set_xlim(-1,1)ax.set_ylim(-1,1)ax.tick_params(left=True,right=True ,top=True,bottom=True,labeltop=True,labelbottom=True,labelleft=True,labelright=True)fig.savefig("test.pgf")

Actual outcome

Labels above the plot are not sitting on the same baseline.
image

(Numbers to the right are aligned suboptimally.)

Expected outcome

Ticks labels (at least the top ones) aligned (sitting on one line).

Additional information

No response

Operating system

Debian Linux

Matplotlib Version

3.7.3

Matplotlib Backend

pgf

Python version

3.9.2

Jupyter version

No response

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