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]: matplotlib.pyplot.annotate with bbox: text is not centered vertically in svg #23003

Open
@thawn

Description

@thawn

Bug summary

I am trying to create an annotation that looks similar to a legend:

plt.annotate('$a = \cdot 10^{-7} kT$s', (1,10),bbox=dict(boxstyle="round",fc="w",ec="0.8",lw=1,alpha=0.8),fontsize=8)

when I export the respective image as svg withrcParams['svg.fonttype'] = 'none', the text is too high:

image

The same figure exported as png looks fine:

image

Code for reproduction

importmatplotlib.pyplotaspltimportnumpyasnpplt.rcParams['svg.fonttype']='none'plt.plot(np.arange(11),np.arange(11))plt.annotate('$a = \cdot 10^{-7} kT$s', (0,9),bbox=dict(boxstyle="round",fc="w",ec="0.8",lw=1,alpha=0.8),fontsize=8)plt.savefig('test.svg',bbox_inches='tight')

Actual outcome

image

Expected outcome

image

Additional information

No response

Operating system

OS/X

Matplotlib Version

3.5.1

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

3.9.12

Jupyter version

jupyter --version Selected Jupyter core packages... IPython : 8.2.0 ipykernel : 6.13.0 ipywidgets : not installed jupyter_client : 7.2.2 jupyter_core : 4.9.2 jupyter_server : not installed jupyterlab : not installed nbclient : not installed nbconvert : not installed nbformat : not installed notebook : not installed qtconsole : not installed traitlets : 5.1.1

Installation

conda

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