Search code examples
matplotlibfigurelibrosa

Why this image is not opening?


Hello there I am using the code below. The image is saved but its not opening. Can some one guide please.

import librosa 
import librosa.display
path='E:/Python_On_All_Dataset/testing_plot/15a02Ea.wav'
y,sr=librosa.load(path,16000)

plt.figure(figsize=(15,8))
librosa.display.waveplot(y,sr=16000)

plt.show()
plt.savefig('sample_wav.png',dpi=300)

Solution

  • The code is correct only plt.show() should be after save command, as plt.show() flush the plot.