I'm trying to use librosa with matplotlib, and using a gridspec and all of the code examples of librosa look like they were intended for use with jupyter notebooks and I'm writing in pyqt. Below is something that looks sort of like my code:
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import matplotlib.gridspec as gridspec
import librosa
self.fig = Figure(figsize=(self.width, self.height), dpi=dpi)
gs = gridspec.GridSpec(2, 2, height_ratios=[3, 1])
self.axes1 = self.fig.add_subplot(gs[1, :])
self.axes2 = self.fig.add_subplot(gs[0, :])
self.axes1.plot(range(array_length), self.array)
self.axes2.specgram(self.array, Fs=44100, scale='dB')
All of the example code looks like:
C = librosa.feature.chroma_cqt(y=y, sr=sr)
plt.subplot(4, 2, 5)
librosa.display.specshow(C, y_axis='chroma')
plt.colorbar()
plt.title('Chromagram')
I am trying to get the spectrogram into gridspec[0, :]. I guess the question is how do I coerce librosa to plot in self.axes2?