Skip to content

[ENH]: add loc parameter to the fig.suptitle() #31339

@pawjast

Description

@pawjast

Problem

If I want to align title to the side, I can do it with ax.set_title() using loc parameter:

fig, ax = plt.subplots(facecolor="whitesmoke")
ax.set_title("The title", loc="left")
Image

But I cannot do the same with fig.suptitle():

fig, ax = plt.subplots(facecolor="whitesmoke")
fig.suptitle("The title", loc="left")

As this produces an error:

Image

I think this is incosistent behaviour.

And I know the docs says this is a function for centered title:

Image

But it also provides parameters to deviate from center via x and ha:

fig, ax = plt.subplots(
    facecolor="whitesmoke"
)
fig.suptitle("The title", x=0.12, ha="left")
Image

So wouldn't it be easier to have the loc parameter in the fig.suptitle() all along?

Proposed solution

Add loc parameter to the fig.suptitle() to provide consistent API with ax.set_title()

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