我用谱图绘制信号的频谱图。但是,Y轴以Hz为单位显示频率。因此,我想知道如何将其缩小1000倍,而不是6000,它变为6,我可以将标签设置为kHz而不是Hz。感谢
我的子图也有问题,当图像窗口缩放到较小的尺寸时,右边的标签与左子图重叠。知道如何避免这种情况吗?
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()