@@ -1673,6 +1673,7 @@ def _process_layout(layout):
1673
1673
return unique_ids , nested
1674
1674
1675
1675
def _do_layout (gs , layout , unique_ids , nested ):
1676
+
1676
1677
rows , cols = layout .shape
1677
1678
output = dict ()
1678
1679
@@ -1702,8 +1703,10 @@ def _do_layout(gs, layout, unique_ids, nested):
1702
1703
gs [slc ], ** {'label' : str (name ), ** subplot_kw })
1703
1704
1704
1705
for (j , k ), nested_layout in nested .items ():
1705
- if not all (len (r ) for r in nested_layout ):
1706
- raise ValueError ("All of the rows must be the same length" )
1706
+ if not all (len (r ) == len (nested_layout [0 ])
1707
+ for r in nested_layout ):
1708
+ raise ValueError (
1709
+ "All of the rows must be the same length." )
1707
1710
nested_layout = np .asarray (nested_layout , dtype = object )
1708
1711
rows , cols = nested_layout .shape
1709
1712
gs_n = gs [j , k ].subgridspec (rows , cols , ** gridspec_kw )
@@ -1716,7 +1719,7 @@ def _do_layout(gs, layout, unique_ids, nested):
1716
1719
f"and the nested layout\n { nested_layout } " )
1717
1720
output .update (nested_output )
1718
1721
return output
1719
- if not all (len (r ) for r in layout ):
1722
+ if not all (len (r ) == len ( layout [ 0 ]) for r in layout ):
1720
1723
raise ValueError ("All of the rows must be the same length" )
1721
1724
layout = np .asarray (layout , dtype = object )
1722
1725
rows , cols = layout .shape
0 commit comments