Skip to content

[Bug]: Cannot toggle set_tight_layout #22847

Closed
@richardsheridan

Description

@richardsheridan

Bug summary

As of #20426 calling Figure.set_tight_layout(False) does not disable the tight layout algorithm.

Code for reproduction

from matplotlib import pyplot as plt

fig, ax = plt.subplots()
fig.set_tight_layout(True)
fig.set_tight_layout(False)
assert not fig.get_tight_layout()

Actual outcome

AssertionError

Expected outcome

clean exit

Additional information

I'm pretty sure this branch just needs to set self.set_layout_engine(None) in the falsey case. Attn: @jklymak

Operating system

No response

Matplotlib Version

main

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

No response

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