I used the specgram to plot the spectrogram of my signal. However, the Y axis display the frequency in Hz. So I want to know how I can scale it down by a factor of 1000 so instead of 6000 it becomes 6, and I can put the label as kHz instead of Hz. Thanks
I also have a problem with the subplot that the label on the right overlap with the left subplot when the image window zoom to a smaller size. Any idea how to avoid that?
self.trjFig = plt.figure()
self.trjFigCanvas = FigureCanvas(self.trjFig)
self.trjFigAx = self.trjFig.add_subplot(121)
self.trjFigAx.set_xlim([-0.5, 0.5])
self.trjFigAx.set_ylim([-0.5, 0.5])
self.trjFigAx.set_title('Trajectory')
self.trjFigAx.plot(self.data[:, 0], self.data[:, 1], ".")
self.specFigAx = self.trjFig.add_subplot(122)
self.specFigAx.set_title('Spectrogram')
self.specFigAx.set_ylabel("Frequency (Hz)")
self.specFigAx.set_xlabel("Time (s)")
self.trjFigToolbar = NavigationToolbar(self.trjFigCanvas,self)
self.specFigAx.specgram(self.velSound, NFFT = 1024, Fs = FS, noverlap = 900, cmap= plt.cm.gist_heat)
self.trjFigCanvas.draw()