How to convert a spectrogram to 3d plot. Python

最后都变了- 提交于 2019-12-07 06:36:43

问题


I am trying to achieve waterfall graph of wav file. In my attempts I noticed that this is basically a spectogram in 3d (or as close to what I need). I am trying to do this in Python with numpy and matplotlib.

My main problem is I don't know how to change the plot of specgram from matplotlib into a 3d plot.

Sample of my "code":

sample ,data = wavfile.read('file.wav')
F = Figure()
a = F.add_subplot(111,projection='3d') 
Spec, t, freq, im = a.specgram(data,Fs=2)

I've got this far and have no clue what to do next. I wanna change already existing plot into 3d. I have no code of changing it to 3d, due to lack of my knowledge.

Is it possible to convert 2d plot to 3d ? If so how ? Am i better off constructing a new plot with data from specgram?

The desired outcome would be something like the following:

Thanks for any replies.

来源:https://stackoverflow.com/questions/48598829/how-to-convert-a-spectrogram-to-3d-plot-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!