Consider that I have a pre-existing figure like:
from matplotlib import pyplot as plt
fig, axes = plt.subplots(nrows=2, ncols=3)
How can I add a 5th subplot that would take both rows in a third column?
I know it's easy to create such a figure from the start using, for example, mosaics like
plt.figure().subplot_mosaic([[1, 2, 3], [4, 5, 3]])
which produces what I want:
But the figure comes from an existing application, and if I were to replicate the same figure manually it'd take a huge amount of code. So really I'd need a way to do it after the first 4 subplots are already built and plotted.
Can this be done? (Preferably with constrained_layout
active, although I'm sure this would be asking too much.)
PS: I tried the solutions here and here but I couldn't make them work for what I want.