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

Automatic title placement wrong if parent axes is off the page #18283

Closed
Labels
topic: geometry managerLayoutEngine, Constrained layout, Tight layout
Milestone
@jnboehm

Description

@jnboehm

Bug report

Bug summary
When calculating the extent of a subplot axes, its contents depend on whether title has been set in the axes below, i. e. the unrelated title bleeds into the extent and gets exported when saving while specifying thebbox_inches.

The extent itself doesn't seem to be the problem, but the inclusion of artefacts that should not be included in the plot, and aren't visible in the full figure (in the bounding box) are included and saved when giving an explicit bounding box tofig.savefig.

Code for reproduction

importmatplotlib.pyplotaspltfig,axs=plt.subplots(2,1)axs[0].plot([1,2], [3,4])extent=axs[0].get_window_extent().transformed(fig.dpi_scale_trans.inverted())fig.savefig('/tmp/expected.png',bbox_inches=extent)axs[1].set_title('pls ignore me')# extents are actually unchangedextent2=axs[0].get_window_extent().transformed(fig.dpi_scale_trans.inverted())fig.savefig('/tmp/actual.png',bbox_inches=extent2)fig.savefig('/tmp/full.png')

Actual outcome
The title ofaxs[1] is shown.

actual

Expected outcome
It should not be included, as visible in the full picture.

expected
full

Matplotlib version

  • Operating system:
  • Matplotlib version: 3.2.1
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.8.2

Environment has been installed with the default conda channel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: geometry managerLayoutEngine, Constrained layout, Tight layout

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp