Hi, I ran into a bug when trying to draw a legend spanning multiple subplots, following issue #392.
For a 2×2 grid of subplots, I’d like to draw a legend that spans the subplots in the first row, and another legend that spans the subplots in the second row, as shown in the code.
However, after I set it up this way, not only does the legend fail to span the subplots, its position also appears at the top of the figure.
import ultraplot as uplt
import numpy as np
state = np.random.RandomState(51423)
fig, axs = uplt.subplots(ncols=2, nrows=2, journal='nat2')
hs = []
colors = uplt.get_colors("grays", 5)
for abc, color in zip("ABCDEF", colors):
data = state.rand(10)
for ax in axs:
(h,) = ax.plot(data, color=color, lw=3, label=f"line {abc}")
hs.append(h)
fig.legend(hs, ncols=3, center=True, frame=False, loc="b", ax=axs[0,:], span=(1,2))
fig.legend(hs, ncols=3, center=True, frame=False, loc="b", ax=axs[1,:], span=(1,2))

Hi, I ran into a bug when trying to draw a legend spanning multiple subplots, following issue #392.
For a 2×2 grid of subplots, I’d like to draw a legend that spans the subplots in the first row, and another legend that spans the subplots in the second row, as shown in the code.
However, after I set it up this way, not only does the legend fail to span the subplots, its position also appears at the top of the figure.