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]: 3.5.0 colorbar outside of its axis when saved into vectorial formats #21672

Closed
@cgadal

Description

@cgadal

Bug summary

For some figure/subplot/colorbar axis aspect ratios, the colorbar is outside of its axes when saved into vectorial formats (pdf, svg).

Code for reproduction

importnumpyasnpimportmatplotlib.pyplotaspltx=np.linspace(0,100,100)y=np.linspace(0,100,100)z=x[None, :]**2+y[:,None]**2fig,axarr=plt.subplots(1,2,figsize=(3,2.8789385625),constrained_layout=True,sharey=True)ax=axarr[0]a=ax.pcolormesh(x,y,z,snap=True)fig.colorbar(a,ax=ax,location='top')#ax=axarr[1]a=ax.pcolormesh(x,y,z,snap=True)fig.colorbar(a,ax=ax,location='top')plt.savefig('test_colorbar.pdf')plt.savefig('test_colorbar.svg')plt.savefig('test_colorbar.png',dpi=800)

Actual outcome

Screenshot from 2021-11-18 17-01-03

Expected outcome

The colorbar should be within its axis, and not shifted upward.

Additional information

  • It does not occur when the figure is saved to non-vectorial format (i.e png, etc ..)
  • In this case, it does not occur for all figure aspect ratios.
  • It was already the case in matplotlib 3.4.3

Operating system

Ubuntu 20

Matplotlib Version

3.5.0

Matplotlib Backend

QtAgg

Python version

3.8.10

Jupyter version

No response

Installation

pip

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