Skip to content
Advertisement

Python spectrogram in 3D (like matlab’s spectrogram function)

My question is the following:

I have all the values that I need for a spectrogram (scipy.fftpack.fft). I would like to create a 3D spectrogram in python.

In MATLAB this is a very simple task, while in python it seems much more complicated. I tried mayavi, 3D plotting matplotlib but I have not managed to do this.

Thanks


My code:

JavaScript

Similar unanswered question: How to convert a spectrogram to 3d plot. Python

Desired plot in python like Matlab’s figure (last plot here: https://www.mathworks.com/help/signal/ref/spectrogram.html)

enter image description here

Advertisement

Answer

You just need to get your arrays in the right shape:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement