code: def test_compressed1():
      fig, axs = plt.subplots(
          3, 2, layout="compressed", sharex=True, sharey=True
      )
      for ax in axs.flat:
          pc = ax.imshow(np.random.randn(20, 20))
  
      fig.colorbar(pc, ax=axs)
      fig.draw_without_rendering()
  
      pos = axs[0, 0].get_position()
      np.testing.assert_allclose(pos.x0, 0.2344, atol=1e-3)
      pos = axs[0, 1].get_position()
      np.testing.assert_allclose(pos.x1, 0.7024, atol=1e-3)
  
      # wider than tall
      fig, axs = plt.subplots(
          2,
          3,
          layout="compressed",
          sharex=True,
          sharey=True,
          figsize=(5, 4),
      )
      for ax in axs.flat:
          pc = ax.imshow(np.random.randn(20, 20))
  
      fig.colorbar(pc, ax=axs)
      fig.draw_without_rendering()
  
      pos = axs[0, 0].get_position()
      np.testing.assert_allclose(pos.x0, 0.06195, atol=1e-3)
      np.testing.assert_allclose(pos.y1, 0.8537, atol=1e-3)
      pos = axs[1, 2].get_position()
      np.testing.assert_allclose(pos.x1, 0.8618, atol=1e-3)
      np.testing.assert_allclose(pos.y0, 0.1934, atol=1e-3)
  
imports: import gc
  import numpy
  import pytest
  import matplotlib
  from matplotlib.testing.decorators import image_comparison
  import matplotlib.pyplot
  import matplotlib.transforms
  from matplotlib import gridspec, ticker
label_desc: Use image node_id 42 for calling a global function with example usage: test_compressed1() without return types