I'm trying to create a plot with two subplots. 1 column, 2 rows. Similar to the image but without the subplot to the right
How can I enforce one subplot to be square and the other one to have the same width without being square?
I tried gridspec without success:
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
fig = plt.figure(constrained_layout=True)
gs = GridSpec(nrows=4, ncols=3, height_ratios=[1, 1, 1, 1], figure=fig)
ax1 = fig.add_subplot(gs[:-1,:])
ax2 = fig.add_subplot(gs[-1,:])
I also tried setting the aspect ratio for both subplots resulting in different widths the subplots:
fig, axs = plt.subplots(2)
axs[0].set_aspect(1)
axs[1].set_aspect(2)
I also tried... but this fixes the x range of the subplots to the same value.
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
F = plt.figure()
grid = ImageGrid(F, 111,
nrows_ncols=(2, 1),
axes_pad=0.1,
)
grid[1].set_aspect(.4)
Thanks for any suggestions...

make_axes_locatable, (3) Adjust the subplot parameters (or gridspec parameters) such that both axes are confined and one is square. I think all those exist as answers on SO already. - ImportanceOfBeingErnest