<h3 dir="auto">Bug summary</h3>
<p dir="auto">When the figure has two columns with different numbers of rows, rows on the same side will have different heights under <code class="notranslate">constrained</code> layout.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt 
panels = [ 
    ['a', 'c'],
    ['a', 'c'],
    ['b', 'c'],
    ['b', 'c'],
]
fig, axes = plt.subplot_mosaic(
         panels, layout = 'constrained')
fig.suptitle('Different height')
fig.canvas.draw()
print(&quot;Hieght of 'a':&quot;, axes['a'].bbox.bounds[3])
print(&quot;Hieght of 'b':&quot;, axes['b'].bbox.bounds[3])
plt.savefig('test.png')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span> 
<span class="pl-s1">panels</span> <span class="pl-c1">=</span> [ 
    [<span class="pl-s">'a'</span>, <span class="pl-s">'c'</span>],
    [<span class="pl-s">'a'</span>, <span class="pl-s">'c'</span>],
    [<span class="pl-s">'b'</span>, <span class="pl-s">'c'</span>],
    [<span class="pl-s">'b'</span>, <span class="pl-s">'c'</span>],
]
<span class="pl-s1">fig</span>, <span class="pl-s1">axes</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplot_mosaic</span>(
         <span class="pl-s1">panels</span>, <span class="pl-s1">layout</span> <span class="pl-c1">=</span> <span class="pl-s">'constrained'</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">suptitle</span>(<span class="pl-s">'Different height'</span>)
<span class="pl-s1">fig</span>.<span class="pl-s1">canvas</span>.<span class="pl-en">draw</span>()
<span class="pl-en">print</span>(<span class="pl-s">"Hieght of 'a':"</span>, <span class="pl-s1">axes</span>[<span class="pl-s">'a'</span>].<span class="pl-s1">bbox</span>.<span class="pl-s1">bounds</span>[<span class="pl-c1">3</span>])
<span class="pl-en">print</span>(<span class="pl-s">"Hieght of 'b':"</span>, <span class="pl-s1">axes</span>[<span class="pl-s">'b'</span>].<span class="pl-s1">bbox</span>.<span class="pl-s1">bounds</span>[<span class="pl-c1">3</span>])
<span class="pl-s1">plt</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'test.png'</span>)</pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto">Hieght of 'a': 180.94277777777785<br>
Hieght of 'b': 189.27677777777777</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/45889298/223366903-2c6800bf-52a9-4a3c-8d43-37dbc81cea07.png"><img src="https://user-images.githubusercontent.com/45889298/223366903-2c6800bf-52a9-4a3c-8d43-37dbc81cea07.png" alt="test" style="max-width: 100%;"></a></p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">Same height for 'a' and 'b'.</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto">No bug when axes are generated using <code class="notranslate">plt.subplot</code> or when the numbers of rows are the same for both columns. Same bug for <code class="notranslate">compressed</code> layout too.</p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Ubuntu 22.04</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.7.1</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">QtAgg</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">Python 3.10.6</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong><br>
When following <a href="https://matplotlib.org/devdocs/gallery/lines_bars_and_markers/categorical_variables.html" rel="nofollow">the documentation on plotting categorical variables</a> the plots do not render. Instead various errors are thrown about converting strings to floats.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt

data = {'apples': 10, 'oranges': 15, 'lemons': 5, 'limes': 20}
names = list(data.keys())
values = list(data.values())

fig, axs = plt.subplots(1, 3, figsize=(9, 3), sharey=True)
axs[0].bar(names, values)
axs[1].scatter(names, values)
axs[2].plot(names, values)
fig.suptitle('Categorical Plotting')"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>

<span class="pl-s1">data</span> <span class="pl-c1">=</span> {<span class="pl-s">'apples'</span>: <span class="pl-c1">10</span>, <span class="pl-s">'oranges'</span>: <span class="pl-c1">15</span>, <span class="pl-s">'lemons'</span>: <span class="pl-c1">5</span>, <span class="pl-s">'limes'</span>: <span class="pl-c1">20</span>}
<span class="pl-s1">names</span> <span class="pl-c1">=</span> <span class="pl-en">list</span>(<span class="pl-s1">data</span>.<span class="pl-en">keys</span>())
<span class="pl-s1">values</span> <span class="pl-c1">=</span> <span class="pl-en">list</span>(<span class="pl-s1">data</span>.<span class="pl-en">values</span>())

<span class="pl-s1">fig</span>, <span class="pl-s1">axs</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-c1">1</span>, <span class="pl-c1">3</span>, <span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">9</span>, <span class="pl-c1">3</span>), <span class="pl-s1">sharey</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-s1">axs</span>[<span class="pl-c1">0</span>].<span class="pl-en">bar</span>(<span class="pl-s1">names</span>, <span class="pl-s1">values</span>)
<span class="pl-s1">axs</span>[<span class="pl-c1">1</span>].<span class="pl-en">scatter</span>(<span class="pl-s1">names</span>, <span class="pl-s1">values</span>)
<span class="pl-s1">axs</span>[<span class="pl-c1">2</span>].<span class="pl-en">plot</span>(<span class="pl-s1">names</span>, <span class="pl-s1">values</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">suptitle</span>(<span class="pl-s">'Categorical Plotting'</span>)</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-32-c50911b594df&gt; in &lt;module&gt;()
      4 
      5 fig, axs = plt.subplots(1, 3, figsize=(9, 3), sharey=True)
----&gt; 6 axs[0].bar(names, values)
      7 axs[1].scatter(names, values)
      8 axs[2].plot(names, values)

/Users/kevin.thompson/venv3/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)
   1896                     warnings.warn(msg % (label_namer, func.__name__),
   1897                                   RuntimeWarning, stacklevel=2)
-&gt; 1898             return func(ax, *args, **kwargs)
   1899         pre_doc = inner.__doc__
   1900         if pre_doc is None:

/Users/kevin.thompson/venv3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in bar(self, left, height, width, bottom, **kwargs)
   2103         if align == 'center':
   2104             if orientation == 'vertical':
-&gt; 2105                 left = [left[i] - width[i] / 2. for i in xrange(len(left))]
   2106             elif orientation == 'horizontal':
   2107                 bottom = [bottom[i] - height[i] / 2.

/Users/kevin.thompson/venv3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in &lt;listcomp&gt;(.0)
   2103         if align == 'center':
   2104             if orientation == 'vertical':
-&gt; 2105                 left = [left[i] - width[i] / 2. for i in xrange(len(left))]
   2106             elif orientation == 'horizontal':
   2107                 bottom = [bottom[i] - height[i] / 2.

TypeError: unsupported operand type(s) for -: 'str' and 'float'"><pre class="notranslate"><code class="notranslate">---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-32-c50911b594df&gt; in &lt;module&gt;()
      4 
      5 fig, axs = plt.subplots(1, 3, figsize=(9, 3), sharey=True)
----&gt; 6 axs[0].bar(names, values)
      7 axs[1].scatter(names, values)
      8 axs[2].plot(names, values)

/Users/kevin.thompson/venv3/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)
   1896                     warnings.warn(msg % (label_namer, func.__name__),
   1897                                   RuntimeWarning, stacklevel=2)
-&gt; 1898             return func(ax, *args, **kwargs)
   1899         pre_doc = inner.__doc__
   1900         if pre_doc is None:

/Users/kevin.thompson/venv3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in bar(self, left, height, width, bottom, **kwargs)
   2103         if align == 'center':
   2104             if orientation == 'vertical':
-&gt; 2105                 left = [left[i] - width[i] / 2. for i in xrange(len(left))]
   2106             elif orientation == 'horizontal':
   2107                 bottom = [bottom[i] - height[i] / 2.

/Users/kevin.thompson/venv3/lib/python3.6/site-packages/matplotlib/axes/_axes.py in &lt;listcomp&gt;(.0)
   2103         if align == 'center':
   2104             if orientation == 'vertical':
-&gt; 2105                 left = [left[i] - width[i] / 2. for i in xrange(len(left))]
   2106             elif orientation == 'horizontal':
   2107                 bottom = [bottom[i] - height[i] / 2.

TypeError: unsupported operand type(s) for -: 'str' and 'float'
</code></pre></div>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">I expected it to render the pretty pictures found in <a href="https://matplotlib.org/devdocs/gallery/lines_bars_and_markers/categorical_variables.html" rel="nofollow">the documentation I was trying to duplicate</a></p>
<p dir="auto"><strong>Matplotlib version</strong></p>
<ul dir="auto">
<li>Operating System: OSX 10.11.6 (El Capitan)</li>
<li>Matplotlib Version: 2.0.2</li>
<li>Python Version: 3.6.0</li>
<li>Jupyter Version (if applicable): 4.3.0</li>
</ul>
<p dir="auto">Installed via pip in a virtualenv</p>