[Bug]: Error using width_ratios with nested mosaic in subplot_mosaic() #24099
Labels
Good first issue
Open a pull request against these issues if there are no active ones!
status: confirmed bug
Milestone
Bug summary
plt.subplot_mosaic() fails with a confusing error message when passing width_ratios (or height_ratios) with a nested list mosaic, unless all outer and inner mosaics have the same number of columns (or rows).
Code for reproduction
Actual outcome
Expected outcome
Additional information
From what I can tell, this happens because the layout is built recursively, passing the same gridspec_kw to subgridspec() at each level of nesting. I realize that the use of width_ratios / height_ratios / gridspec_kw with nested list mosaics could get complicated, but it would be nice to be able to at least specify them for the outer list, or in some other way implement this feature for nested list layouts. If not, maybe include a helpful error message that explains this limitation so the user doesn't think they have specified the wrong number of ratios.
Operating system
Windows 10
Matplotlib Version
3.6.0
Matplotlib Backend
QtAgg
Python version
3.10
Jupyter version
No response
Installation
conda
The text was updated successfully, but these errors were encountered: