Hello, I’m trying to add a figure legend on the top of the figure that is using `costrained_layout`

. However, matplotlib puts it inside the axis. The code:

```
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(constrained_layout=True)
ax = fig.subplots()
x = np.linspace(0, 2*np.pi, 200)
for n in [1, 2, 3, 4]:
ax.plot(x, np.sin(n*x), label=f"sin({n}x)")
fig.legend(loc="upper center", ncol=4, mode="expand")
plt.savefig("four_plots.png", pad_inches=0.0, bbox_inches="tight")
```

I managed to move it out of the axis by using

```
fig.legend(bbox_to_anchor=(0., 1., 1., 0.01), loc="lower left", ncol=4, mode="expand")
```

instead. However, now the box around the legend is clipped of at the top:

How would I do this correctly?