I want to make a matplotlib figure that has two components:
A 2x2 "four pack" of subplots in the lower half of the figure
A subplot above the four pack that is the size of the four pack.
I have seen this answer where subplots can have different dimensions. How can that approach be tweaked when there are multiple columns and rows, however? Or is a completely different approach warranted?
My final figure should be arranged something like this:

If there is a straightforward way to have a left-right oritentation, shown below, that would be helpful, too.

You can use plt.subplot_mosaic or GridSpec. Someone else can write an answer using GridSpec, but here is how you'd do it using subplot_mosaic.
For the large plot on top and 4 below it:
import matplotlib.pyplot as plt
fig, axs_dict = plt.subplot_mosaic("AA;AA;BC;DE")
If you want to put the large plot on the left and the four smaller on the right then just using this string: "AABC;AADE".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With