Grid plots fail on matplotlib 3.9.2 with the following trace :
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[17], line 1
----> 1 mr.plot_waveforms(recgen, electrode='max', cmap='rainbow')
File ~/Documents/GitHub/MEArec/src/MEArec/tools.py:3339, in plot_waveforms(recgen, spiketrain_id, ax, color, cmap, electrode, max_waveforms, ncols, cut_out)
3336 nrows = 1
3337 ncols = len(spiketrain_id)
-> 3339 gs = gridspec.GridSpecFromSubplotSpec(nrows, ncols, subplot_spec=ax)
3341 # find ylim
3342 min_wf = 0
File ~/.conda/envs/simul/lib/python3.10/site-packages/matplotlib/gridspec.py:490, in GridSpecFromSubplotSpec.__init__(self, nrows, ncols, subplot_spec, wspace, hspace, height_ratios, width_ratios)
488 self._subplot_spec = subplot_spec
489 else:
--> 490 raise TypeError(
491 "subplot_spec must be type SubplotSpec, "
492 "usually from GridSpec, or axes.get_subplotspec.")
493 self.figure = self._subplot_spec.get_gridspec().figure
494 super().__init__(nrows, ncols,
495 width_ratios=width_ratios,
496 height_ratios=height_ratios)
TypeError: subplot_spec must be type SubplotSpec, usually from GridSpec, or axes.get_subplotspec.
The matplotlib blame traces back to this commit which seems to have shipped with the latest version.
The fix involves explicitely calling ax.get_subplotspec() instead of just passing ax.
It doesn't seem to be a breaking change, and I've successfully tested it with matplotlib 3.8.0
Grid plots fail on
matplotlib
3.9.2 with the following trace :The
matplotlib
blame traces back to this commit which seems to have shipped with the latest version.The fix involves explicitely calling
ax.get_subplotspec()
instead of just passingax
. It doesn't seem to be a breaking change, and I've successfully tested it withmatplotlib
3.8.0