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

Weird behaviour of suptitle() when horizontalalignment is not 'center' #12197

Closed
Labels
DocumentationGood first issueOpen a pull request against these issues if there are no active ones!
Milestone
@gansanay

Description

@gansanay

Bug report

Bug summary

horizontalalignment = 'left' aligns the title on the right,horizontalalignment = 'right' aligns a short title on the left,horizontalalignment = 'right' displaces a longer title on the far left

Code for reproduction

# Left alignment test, short titlefig=plt.figure(figsize=(9,4))ax=fig.add_subplot(111)fig.suptitle('This figure suptitle should be on the left',horizontalalignment='left')ax.set_title('This axis title should be on the left',loc='left');fig.savefig('left_align.png')# Right alignment test, short titlefig=plt.figure(figsize=(9,4))ax=fig.add_subplot(111)fig.suptitle('This figure suptitle should be on the right',horizontalalignment='right')ax.set_title('This axis title should be on the right',loc='right');fig.savefig('right_align.png')# Right alignment test, longer titlefig=plt.figure(figsize=(9,4))ax=fig.add_subplot(111)fig.suptitle('This figure suptitle should be on the right but it is far left',horizontalalignment='right')ax.set_title('This axis title should be on the left',loc='left')fig.savefig('far_left.png');

Actual outcome

  • Left alignment test, short title
    left_align

  • Right alignment test, short title
    right_align

  • Right alignment test, longer title
    far_left

Expected outcome

The following code manually sets the figure title at the expected position:

fig=plt.figure(figsize=(9,4))ax=fig.add_subplot(111)fig.suptitle('This figure suptitle is long but it is manually positioned',x=0.38)ax.set_title('This axis title should be on the left',loc='left')fig.savefig('manual_pos.png');

Which gives:
manual_pos

Matplotlib version

  • Operating system: Windows
  • Matplotlib version: 2.1.2 and 2.2.3
  • Matplotlib backend: agg
  • Python version: 3.6.4
  • Jupyter version: 4.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationGood first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp