I can set constrained_layout_pads
with
fig, ax = plt.subplots(layout='constrained')
fig.set_constrained_layout_pads(w_pad=0.5, h_pad=0.5)
I can also do it in one call: plt.subplots(constrained_layout={'w_pad': 0.5, 'h_pad': 0.5})
So far so good.
According to matplotlib.figure — Matplotlib 3.8.2 documentation I should be able to pass figure kwargs in plt.subplots()
:
fig, ax = plt.subplots(layout='constrained',
constrained_layout_pads={'w_pad': 0.5, 'h_pad': 0.5})`
which results, however, in a
TypeError: set_constrained_layout_pads() takes 1 positional argument but 2 were given
The documentation mentions a single value (float
), although the parameter name is in plural:
constrained_layout_pads
float, default:rcParams["figure.constrained_layout.w_pad"]
(default:0.04167
)
but plt.subplots(constrained_layout_pads=0.5)
results in the same error.
So my question is how to use constrained_layout_pads
in the plt.subplots
call.