1
参考此链接:https://aqibsaeed.github.io/2016-09-03-urban-sound-classification-part-1/,我试图做出同样的波纹图,但是,我得到了如下图:。如何使用matplotlib使用librosa很好地显示波浪图
我运行这些蟒蛇代码:
def plot_waves(sound_names, raw_sounds):
i = 1
fig = plt.figure()
for n, f in zip(sound_names, raw_sounds):
plt.subplot(10, 1, i)
librosa.display.waveplot(np.array(f), sr=22050)
plt.title(n.title())
i += 1
plt.suptitle("Figure 1: Waveplot", x=0.5, y=0.915, fontsize=18)
plt.show()
任何想法如何改进以达到相同的图所示的链接?谢谢。
我不采取样本代码特别是对于图= plt.figure(figsize =(25,60),DPI = 900),因为,它抛出异常:_tkinter.TclError:对于没有足够的可用存储器图像缓冲区。对我来说有两个问题:1)。 suptitle压扁的样子。 2)小区的数字相互重叠。无法尝试找出合适的参数。 –
尝试摆脱'dpi = 900'参数并使用'fig = plt.figure(figsize =(25,60))'代替。这听起来像是你试图为你的机器加载过多的内存,如果你只是想看看屏幕上的图像,dpi设置是不重要的。问题(1)将通过调整“plt.suptitle”中的y位置来解决,如上所述。如果'y = 0.915'不起作用,请尝试'y = 0.93'等等。问题(2)将通过使用'figsize =(width,height)'参数来增加图形相对于宽度的高度来解决。 – Brian