Description
Problem
I was just messing aroung with trying to see if I could use the (super nice!) plt.subplot_mosaic
function with a mixture of 2d and 3d axes, but didn't get anywhere. Looking into it, it seems like it could be possible with subplot_kw = {"projection": "3d"}
, but this is static across the different subplots (or more accurately, calls to plt.add_subplot
).
Proposed Solution
From looking at the source code (specifically at these line in gridspec.py
, since that's where I believe the function calls eventually end up) it seems like it may be possible to package subplot_kw
s in an object of size _nrows
x _ncols
, since that is the dimensions iterated over.
matplotlib/lib/matplotlib/gridspec.py
Lines 299 to 308 in 9c530bc
The only part that's unclear to me from an implementation standpoint is whether this would necessitate a new kwarg itself, or perhaps one can use single dispatch or conditional logic to handle the case where subplot_kw
is not dict-like.
Happy to have a go if this is desired and/or the functionality exists already and I'm blindsighted to it :)
Additional context and prior art
Could be many scenarios where one would want to control each subplot! I think it would be super neat to be able to do all this from one call to plt.subplots
:D